为什么此Cursor的输出为null? [英] Why is the Output of this Cursor null?
本文介绍了为什么此Cursor的输出为null?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
id列包含值
1
2
3
---------------
以下语句的输出为"hello",这意味着@i为空.有人可以向我解释这怎么可能吗?
The id column contain the value
1
2
3
---------------
The output of the following statement is "hello", which would mean that @i was null. Can anybody explain to me how this can be?
declare c cursor for select id from student1
open c
declare @i int
fetch next from c into @i
if @i!=null
print @i
else
print 'hello'
任何帮助深表感谢!
在此先感谢!
Any help is deeply appreciated!
Thanks in advance!
推荐答案
try:
try :
if @i is not null
print @i
else
print 'hello'
这给出的输出为1
this gives the output as 1
这篇关于为什么此Cursor的输出为null?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文