有关ntext的存储过程 急!高手请进,在线等待....

thankyourfish 2004-11-19 10:12:01
我要将一个表中的某些记录插入到该表中,但ntext不能用中间变量插入进去,如下存储过程:
declare @type as nvarchar(20),@typetime as smalldatetime,@content as ntext
declare Insert_cursor scroll cursor
for
select [type],[typename],[typetime],[content] from [content] where [uid]=999999999
open Insert_cursor
select @i=1
while @i<=@@cursor_rows
begin
fetch next from Insert_cursor
into @type,@typename,@typetime,@content

insert into [web_module].[dbo].[type]([type],[typename],[typetime],[content])
values(@type,@typename,@typetime,@content)
select @i=@i+1

end
close Insert_cursor
deallocate Insert_cursor

[content]类型为ntext 但系统报告不能用ntext,image等类型进行等,有什么办法,请高手指点!!!
...全文
161 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjcxc 元老 2004-11-23
  • 打赏
  • 举报
回复
@content 是ntext参数,不能用于游标中为其赋值
zjcxc 元老 2004-11-23
  • 打赏
  • 举报
回复
--其实楼主的处理,直接用insert这样写就行了

declare @type as nvarchar(20),@typetime as smalldatetime,@content as ntext

insert into [web_module].[dbo].[type]([type],[typename],[typetime],[content])
select [type],[typename],[typetime],[content]
from [content] where [uid]=999999999
zjcxc 元老 2004-11-23
  • 打赏
  • 举报
回复
估计是你的游标中有ntext字段吧? 那样是不允许的.
zjcxc 元老 2004-11-23
  • 打赏
  • 举报
回复
--这种写法是可以通过的
insert into [web_module].[dbo].[type]([type],[typename],[typetime],[content])
values(@type,@typename,@typetime,@content)

--问题应该是出在你的其他处理行上(存储过程没帖全,表结构没有写出来,无法分析错误出在具体那行)
davorsuker39 2004-11-23
  • 打赏
  • 举报
回复
,@content 里面是什么数据呢?
cainiao000 2004-11-23
  • 打赏
  • 举报
回复
帮你顶.

34,588

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧