日期:2014-05-18  浏览次数:20384 次

ms-sql top where和 变量的问题
declare @num int
set @num=9
exec('select top ' + @num + ' * from 职工 where 仓库号 in(wh1,wh4)')



select top 9 * from 职工 where 仓库号 in('wh1','wh2')

怎么实现啊,上面使用动态SQL出现错误! 拜求~

------解决方案--------------------
2000用动态sql,2005+加个括号就行,