T-SQL tips: Replace function example
In the developer database (MS SQL Server) I had a field, in which all the values were the same. The value was "OldDoc.txt". I wanted to make values unique and for this I wanted to add "ID" before ".txt".
The SELECT expression is like this:
select top 100 REPLACE(DOKNAME, '.txt', CONCAT(ID , '.txt')) from [myTable]
To update the values, you can execute this command:
update [myTable] set DOKNAME = REPLACE(DOKNAME, '.txt', CONCAT(ID , '.txt'))