日期:2014-05-17 浏览次数:20533 次
use TFDB
go
declare @s varchar(max)
select @s=isnull(@s+' union all ','')+'select sum(sl) as sl,sum(je) as je from '+Name from sys.tables where name like '__[_]aa[_]bb'
exec('select sum(sl) as sl,sum(je) as je from ('+@s+') as a')