- SQL code
begindeclare @id intdeclare @id2 intdeclare youbiao cursor for select id from Db_TranRD where ExitTime is null and carid is not nullopen youbiaofetch next from youbiao into @idwhile(@@fetch_status=0)beginprint @id set @id2='select trid from Db_Alarm where [email protected]' if @id2 is null begin print @id2fetch next from youbiao into @idendendclose youbiao deallocate youbiaoend
提示 消息 245,级别 16,状态 1,第 10 行
在将 varchar 值 'select trid from Db_Alarm where [email protected]' 转换成数据类型 int 时失败。
------解决方案--------------------
------解决方案--------------------
- SQL code
begindeclare @id intdeclare @id2 intdeclare youbiao cursor for select id from Db_TranRD where ExitTime is null and carid is not nullopen youbiaofetch next from youbiao into @idwhile(@@fetch_status=0)beginprint @id select @id2=trid from Db_Alarm where [email protected] if @id2 is null begin print @id2fetch next from youbiao into @idendendclose youbiao deallocate youbiaoend--你应该是这个意思
------解决方案--------------------
果然是押输了,最近好勤快。
------解决方案--------------------
declare @id2 int
set @id2='select trid from Db_Alarm where [email protected]'
消息 245,级别 16,状态 1,第 2 行
在将 varchar 值 'select trid from Db_Alarm where [email protected]' 转换成数据类型 int 时失败。