日期:2014-05-17 浏览次数:20455 次
create procedure sp_xxxx @bname nvarchar(100) --declare @bname char(20) set @bname='msdb..zc_khls_201209' select * from @bname where date_bf='20120926'
------解决方案--------------------
declare @bname char(20) set @bname='msdb..zc_khls_201209' exec('select * from' +@bname 'where date_bf='20120926'')
------解决方案--------------------
declare @bname char(20) set @bname='msdb..zc_khls_201209' DECLARE @sql NVARCHAR(max) SET @sql='select * from '+@bname+' where date_bf=''20120926'' ' PRINT @sql EXEC (@sql)
------解决方案--------------------
晕,网速卡了一下就2个人回复了。