This is a discussion on Stored Procedure within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, I want to change the data in a few fields of a table. There are many records (about ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I want to change the data in a few fields of a table. There are many records (about 1k+). All I want to do to these fields is to append a string to the starting of data in the fields. eg: Old Data -> --------------------------- Image --------------------------- A1.jpg A2.jpg Required data -> ----------------------------- Image ---------------------------- \Images\A1.jpg \Images\A2.jpg For this purpose, should I use a procedure or is there any other possible way out? Awaiting your replies, Regards Shwetabh |
| |||
| Try: UPDATE MyTable SET ImagePath = '\Images\' + ImagePath This can be encapsulated in a stored procedure if needed: CREATE PROC dbo.UpdateImagePath @ImagePathPrefix varchar(255) AS UPDATE MyTable SET ImagePath = @ImagePathPrefix + ImagePath GO EXEC dbo.UpdateImagePath '\Images\' -- Hope this helps. Dan Guzman SQL Server MVP "Shwetabh" <shwetabhgoel@gmail.com> wrote in message news:1141734360.018259.125170@i40g2000cwc.googlegr oups.com... > Hi, > > I want to change the data in a few fields of a table. > There are many records (about 1k+). All I want to do to > these fields is to append a string to the starting of data in the > fields. > eg: > > Old Data -> > > --------------------------- > Image > --------------------------- > A1.jpg > A2.jpg > > > > Required data -> > > > ----------------------------- > Image > ---------------------------- > \Images\A1.jpg > \Images\A2.jpg > > > > > > For this purpose, should I use a procedure or is there any other > possible way out? > > Awaiting your replies, > Regards > Shwetabh > |