日期:2014-05-19  浏览次数:20439 次

求教简单的sql

set   @Note= 's '
declare   @ss   varchar(8000)
set   @ss= '
select   *   from  
'+@Note+ 'ty '
--   select   @ss
--   exec(@ss)

不用动态sql
我想实现下面的功能

select   *   from     sty
这样写不对
select   *   from  
' '+@Note+ ' 'ty

------解决方案--------------------
表名是動態的,必須使用動態SQL語句
------解决方案--------------------
不能,只能用 exec或者sp_executesql
------解决方案--------------------
lz

今天正好有个帖子适合你看~:)

http://community.csdn.net/Expert/topic/5451/5451726.xml?temp=.3342859