我需要获取varbinary(max)字段并将该字段的内容替换为varchar(max),然后我需要将更改作为varbinary(max)插入到列中。我认为最好的方法是使用游标。这是我的,但我不知道如何更新回varbinary(最大)...任何帮助将不胜感激
declare @content_id int
declare @content varchar(max)
declare cur cursor for
select d.content_id, CAST(d.content as varchar(max)) as content from item as a
join assignment as b on b.itm_id = a.itm_id
join attachment as c on c.att_id = b.att_id
join digitalassetcontent as d on d.content_key = c.content_key
where c.att_type like 'text%';
Open cur
fetch next from cur into @content_id,@content
while(@@FETCH_STATUS=0)
begin
update digitalassetcontent
SET content = replace(content, '<STYLE>H1{font-weight:bold}H1{font-size: 14pt}OL</STYLE><H1>Product Description</H1><P>', '')
where content_id = @content_id
fetch next from cur into @content_id,@content
End
close cur
deallocate cur