SQLノート[長期更新](-2015.4)
2350 ワード
【 , , 】
--
SELECT * INTO A FROM B A , B B A , A,B 。
insert into A select * from B A , B A , A B , 。
--
SELECT * INTO table1 FROM DBTest.dbo.table1
--
SELECT * FROM sysobjects WHERE xtype='U'
--SELECT * FROM sys.objects WHERE type='U'
-- , sql
declare @tb_name nvarchar(100)
declare @i int
declare @tb table(id int identity(1,1),name nvarchar(1000))
set @i = 1
set @tb_name = 'cx' --
insert into @tb(name)
select t.name
from sysobjects t
where xtype='u' and t.name like @tb_name+'%'
while @i <= (select COUNT(*) from @tb)
begin
select @tb_name = name from @tb where id = @i;
exec('select * from '+@tb_name);
set @i = @i + 1
end