日期:2014-05-17 浏览次数:20468 次
declare @aaa varchar(100)
set @sql='select * from TSQLFundamentals2008.sales.customers'
exec ('select * into a from ('+@aaa+') a')
select * from a
-- 方法1
create table [表名]([字段列表])
insert into [表名]
exec [存储过程名]
-- 方法2
select *
into [表名]
from openrowset('SQLOLEDB',
'SERVER=[服务器名];uid=[帐号];pwd=[密码];Database=[数据库名]',
'exec [存储过程名]')