存储过程的一个简单的问题

liutingrun 2007-11-28 10:33:19
exec('select col from tableName where ...')
怎样取得选择出的col的值?
不是通过into到临时表中,谢谢
或有更好的解决方法?
...全文
41 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunhonglei2004 2007-11-28
  • 打赏
  • 举报
回复
不明白,选择出的col的值为一个???
这样??


declare @a char(10)
select @a=col from tablename where -------
-狙击手- 2007-11-28
  • 打赏
  • 举报
回复
declare @i int

exec sp_executesql N'select @i =col from tableName where ...',N'@i int out',@i out
print @i

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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