社区
MS-SQL Server
帖子详情
有关select @var 在exec () 中 的模梭两可的问题,急
tofool
2003-05-20 09:55:15
declare @code int
select @code=-1
select @sql='select @code=code from '+@tablename+' where '+ ltrim(rtrim(@field))+' is null '
print @sql
exec(@sql)
注:所有的变量都有定义。
它提示的错误信息是:必须定义@code 。
我想有什么办法 达到 我想要的结果??! 换一个方法也行!
...全文
119
7
打赏
收藏
有关select @var 在exec () 中 的模梭两可的问题,急
declare @code int select @code=-1 select @sql='select @code=code from '+@tablename+' where '+ ltrim(rtrim(@field))+' is null ' print @sql exec(@sql) 注:所有的变量都有定义。 它提示的错误信息是:必须定义@code 。 我想有什么办法 达到 我想要的结果??! 换一个方法也行!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
tofool
2003-05-20
打赏
举报
回复
请问,sp_executesql 是不是任何角色,都可以使用??
还是只有admin 角色才能使用!?
happydreamer
2003-05-20
打赏
举报
回复
要用sp_executesql exec不支持动态输出
愉快的登山者
2003-05-20
打赏
举报
回复
declare @code int
select @code=-1
select @sql=N'select @code=code from '+@tablename+' where '+ ltrim(rtrim(@field))+' is null '
execute sp_executesql
@sql,
N'@code int output',
@code = @code output
select @code
pengdali
2003-05-20
打赏
举报
回复
declare @code int,@sql nvarchar(4000)
select @code=-1
select @sql='select @code=code from '+@tablename+' where '+ ltrim(rtrim(@field))+' is null '
print @sql
exec sp_executesql @sql,N'@code int output',@code output
select @code
pengdali
2003-05-20
打赏
举报
回复
declare @code int,@sql nvarchar(4000)
select @code=-1
select @sql='select @code=code from '+@tablename+' where '+ ltrim(rtrim(@field))+' is null '
print @sql
exec sp_executesql @sql,N'@code int output',@code output
select @code
firetoucher
2003-05-20
打赏
举报
回复
select @sql='
declare @code int
select @code=-1
select @code=code from '+@tablename+' where '+ ltrim(rtrim(@field))+' is null '
print @sql
exec(@sql)
pengdali
2003-05-20
打赏
举报
回复
declare @code int
select @code=-1
select @sql='select @code=code from '+@tablename+' where '+ ltrim(rtrim(@field))+' is null '
print @sql
exec sp_executesql @sql,N'@code int output',@code output
select @code
行业分类-设备装置-水陆
两
可的稳定浮体平台及其房屋的沉浮方法及其用途.zip
行业分类-设备装置-水陆
两
可的稳定浮体平台及其房屋的沉浮方法及其用途
功能短句的语义成分对
两
可自然物体分类的影响
12..王哲*,严璘璘,孙宇浩,傅小兰. (2017). ., 20, 394~399
家庭居室装饰装修工程施工合同.pdf
家庭居室装饰装修工程施工合同.pdf
2021版高考语文一轮复习第3板块语言文字运用9辨析并修改蹭5“表意不明”与“不合逻辑”课件
2021版高考语文一轮复习第3板块语言文字运用9辨析并修改蹭5“表意不明”与“不合逻辑”课件
2021-2022计算机二级等级考试试题及答案No.12038.docx
2021-2022计算机二级等级考试试题及答案No.12038.docx
MS-SQL Server
34,874
社区成员
254,639
社区内容
发帖
与我相关
我的任务
MS-SQL Server
MS-SQL Server相关内容讨论专区
复制链接
扫一扫
分享
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章