更新NTEXT的方法

declare @id numeric(18,0)

DECLARE ResultSet_News CURSOR FOR

SELECT Id FROM product_ta_product;

OPEN ResultSet_News;

FETCH NEXT FROM ResultSet_News into @Id

WHILE @@FETCH_STATUS = 0

BEGIN

print @id

DECLARE @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;

你可能感兴趣的:(text)