May 1, 2009 at 2:03 pm
I have the following...
Declare @TempTable As VarChar(200)
Set @TempTable = 'UserName200951125126427'
EXEC('Select * Into #' + @TempTable From [MySourceTable])
I get the result...
(253 row(s) affected)
I try and query the temp table and I get the...
Invalid object name
If data was inserted, then where/what table then?
May 1, 2009 at 2:06 pm
Warren Peace (5/1/2009)
I have the following...Declare @TempTable As VarChar(200)
Set @TempTable = 'UserName200951125126427'
EXEC('Select * Into #' + @TempTable From [MySourceTable])
I get the result...
(253 row(s) affected)
I try and query the temp table and I get the...
Invalid object name
If data was inserted, then where/what table then?
You are using dynamic SQL. The temporary table is created within the process of the EXEC. When that returns, the temporary table goes out of scope and is dropped.
May 1, 2009 at 4:04 pm
That was it.
Thanks, I got it going!
May 3, 2009 at 6:06 pm
Warren Peace (5/1/2009)
That was it.Thanks, I got it going!
Could you post the code that solved the problem, please? Thanks.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply