Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kevin24
Starting Member
13 Posts |
Posted - 2011-12-27 : 00:27:50
|
| Hi, I have a database with many lines of data I wish to change thedata in one of the columns by adding additional text.Currently the column shows 'FilePath' and the data shows 'xyz.jpg'.I want the data to show 'Folder\xyz.jpg' where "Folder\" is the additional text to be added to each column row.How do I achieve this please. Many thanks. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-12-27 : 00:35:19
|
[code]update yourtableset thecolumn = 'Folder\' + thecolumn[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-27 : 02:27:36
|
| [code]update yourtableset thecolumn = STUFF(thecolumn,1,0,'Folder\')[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
kevin24
Starting Member
13 Posts |
Posted - 2011-12-27 : 03:54:33
|
| Hi, Thanks very much. I have one more update, which I guess is very much similar to the previous one.The same database and table. I wish to change thedata in one of the columns by adding additional text.Currently the column shows 'FilePath' and the data now shows 'Images\xyz.jpg or bmp'.I want the data to show 'Images\xyz.jpg' ie. all show "a jpg file". So the difference is that some data is being replaced.Some of the data is already correct.Many thanks your kind assistance again. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-12-27 : 04:05:57
|
[code]update yourtableset FilePath = replace(FilePath, '.bmp', '.jpg')where FilePath like %.bmp%'[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|
|