vikas bindra (2/3/2009)
you can not use table variable in: INSERT INTO @tableVar SELECT * FROM anyTable.
You can't?
create table TestingVariables (id int, strng varchar(10))
insert into TestingVariables (id, strng) values (1,'a')
insert into TestingVariables (id, strng) values (2,'b')
insert into TestingVariables (id, strng) values (3,'c')
insert into TestingVariables (id, strng) values (4,'d')
GO
declare @Testng2 table (id int, somestring varchar(10))
insert into @Testng2
select * from TestingVariables
select * from @Testng2
GO
drop table TestingVariables
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability