存储过程高手请进(在线等)

songzutuan 2004-04-08 09:00:48
exec('select count(*) from tj_gxgz_plan where jhbh in ' + @变量)
现在要判断他是否>0,请问各位如何来判断
...全文
27 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
txlicenhe 2004-04-08
  • 打赏
  • 举报
回复
楼上的。
zjcxc 2004-04-08
  • 打赏
  • 举报
回复
注意我定义的变量的类型,@s一定要unicode类型(nvarchar,nchar,ntext<当然存储过程不能直接操作这种变量>)
zjcxc 2004-04-08
  • 打赏
  • 举报
回复
declare @s nvarchar(4000),@re int
set @s='select @re=count(*) from tj_gxgz_plan where jhbh in ' + @变量
exec sp_executesql @s,N'@re int out',@re out
if @re>0
print '结果>0'

victorycyz 2004-04-08
  • 打赏
  • 举报
回复

在前台读:
if rs.fields(0)>0 then
...
end if

22,210

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧