首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

计划任务失误

2012-10-10 
计划任务出错SQL codebegindeclare @id intdeclare @id2 intdeclare youbiao cursor for select id from D

计划任务出错

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 trid=@id'  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 trid=@id' 转换成数据类型 int 时失败。

[解决办法]
探讨
SQL code
begin
declare @id int
declare @id2 int
declare youbiao cursor for select id from Db_TranRD where ExitTime is null and carid is not null
open youbiao
fetch next from youbiao into @id
while(@@……

[解决办法]
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 trid=@id  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 trid=@id'

消息 245,级别 16,状态 1,第 2 行
在将 varchar 值 'select trid from Db_Alarm where trid=@id' 转换成数据类型 int 时失败。

热点排行