存储过程中 如何在Exec ('...')中 判断某字段是否为空?

带参存储过程(参数为@Num)中
要找出Test表中前@Num条PicUrl字段不为空的记录
在Exec('...')中 应该如何写?

创建存储过程
create procedure MyProc
@para1 int,  --参数一
with encryption--加密
as
select top @paral * from 表名 where PicUrl<>' '

使用存储过程
exec MyPro 10
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-10-16
Exec('select top '+@Num+' PicUrl,* form Test where PicUrl is not null')
大家正在搜