Hi need to replace the name of a document in static HTML that is stored in a 2016 SQL Server database.
The table name is contract.departmentInfo and the column with all the HTML is called staticHtmlForAdmins
So I’m trying to use the REPLACE function, but it keeps telling me that the column name is invalid even though I know it’s the correct name.
Here is my SQL:
SELECT REPLACE(staticHtmlForAdmins,'2019_Rule_additions.pdf','New_Rules_2020_2021.docx'); from contract.departmentInfo where deptID = 374352
Is there any reason why the above wouldn’t work?
Thanks!
Advertisement
Answer
The error is normal
SELECT REPLACE(staticHtmlForAdmins,'2019_Rule_additions.pdf','New_Rules_2020_2021.docx'); from contract.departmentInfo where deptID = 374352
Remove the ; after
REPLACE(staticHtmlForAdmins,'2019_Rule_additions.pdf','New_Rules_2020_2021.docx')