摘要:
今天遇到一个错误,自己一直没有意思到这样写是错误的。在游标循环过程中使用变量要注意declare @a;select @a =column1 from table1 where column2 = '123'if @a is nullbeginend原以为如果找不到'123'的记录,变量@a 会被赋成null,可事实上,@a 会保留上一次loop取到的有效值(即非null的历史值)应该改为set @a = select column1 from table1 where column2 = '123'这样才能在找不到记录时正确将@a设置为null 阅读全文
posted @ 2011-10-14 09:02
litsword
阅读(842)
评论(0)
推荐(0)
浙公网安备 33010602011771号