|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, February 21, 2013 2:49 AM
Points: 26,
Visits: 91
|
|
I got following error while this x_TruncateTable proc:
Server: Msg 197, Level 15, State 1, Procedure x_TruncateTable, Line 126 EXECUTE cannot be used as a source when inserting into a table variable.
plz clarify on this.I am executing it on sql server 2000.
thx
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Thursday, April 11, 2013 8:16 AM
Points: 532,
Visits: 980
|
|
can you post the code?
-Vikas Bindra
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Thursday, April 11, 2013 8:16 AM
Points: 532,
Visits: 980
|
|
As the code is not posted, I am guessing you are doing something like:
INSERT INTO @yourTableVar Execute yourSP
Please note the following things about the table variables - You can not use the table variable to get the output of stored procedure. - You can not use SELECT INTO with table variables. - you can not use table variable in: INSERT INTO @tableVar SELECT * FROM anyTable.
and lot more...
-Vikas Bindra
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:30 AM
Points: 37,725,
Visits: 29,982
|
|
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 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Thursday, April 11, 2013 8:16 AM
Points: 532,
Visits: 980
|
|
Hey Gail! Was this possible in SQL 2000 also?
-Vikas Bindra
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:30 AM
Points: 37,725,
Visits: 29,982
|
|
vikas bindra (2/4/2009) Hey Gail! Was this possible in SQL 2000 also?
Try it and find out. My SQL 2000 instance is 400km away.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Thursday, April 11, 2013 8:16 AM
Points: 532,
Visits: 980
|
|
I too doesn't have SQL 2000.
-Vikas Bindra
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Friday, May 17, 2013 2:11 PM
Points: 3,108,
Visits: 2,114
|
|
It workd on SQL 2000 ...
My version -
-------------------------------------------------------------------------------------------------------------------------------- Microsoft SQL Server 2000 - 8.00.2273 (Intel X86) Mar 7 2008 22:19:58 Copyright (c) 1988-2003 Microsoft Corporation Stand
(1 row(s) affected)
The results:
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
(4 row(s) affected)
id somestring ----------- ---------- 1 a 2 b 3 c 4 d
(4 row(s) affected)
Regards Rudy Komacsar Senior Database Administrator
"Ave Caesar! - Morituri te salutamus."
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:30 AM
Points: 37,725,
Visits: 29,982
|
|
rudy komacsar (2/5/2009) It workd on SQL 2000 ...
Thanks for the test.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Thursday, April 11, 2013 8:16 AM
Points: 532,
Visits: 980
|
|
Thanks Rudy!!
-Vikas Bindra
|
|
|
|