declare
@id numeric ( 18 , 0 )DECLARE
ResultSet_News CURSOR FORSELECT
Id FROM product_ta_product ;OPEN
ResultSet_News ;FETCH
NEXT FROM ResultSet_News into @IdWHILE
@@FETCH_STATUS = 0 BEGIN print @idDECLARE
@CommentVar nvarchar ( 4000 );-- Read in existing comments from COMMENTS column in view named MyView
SELECT
@CommentVar = product_description FROM product_ta_product WHERE id = @id ;-- Insert text a top of comment (example is a running history with most recent first)
SET
@CommentVar = replace ( @CommentVar , 'http://www.4wdcc.com/admin' , 'http://www.leods.com/admin' );-- Now go update the field
UPDATE
product_ta_product SET product_description = @CommentVar WHERE id = @id ;FETCH NEXT FROM ResultSet_News into @Id END ;
CLOSE
ResultSet_News ;DEALLOCATE
ResultSet_News ;