Reputation: 117
Through the Import/Export wizard (2008 R2) I'm trying to get data from a View and do some joins with it and put the data in a temp table then do a final select statement at the bottom.
But I keep getting a message saying that my first temp table definition is invalid.
Here's the def:
Create Table #CT (Code int, Col1 varchar(75), Col2 varchar(75), Col3 int)
INSERT INTO #CT
SELECT *
FROM...
I know this is good because I can run it directly on the server without problems.
Is it that Imp/Exp wiz doesn't allow these kinds of queries, where there's complex statements?
Upvotes: 2
Views: 4557
Reputation: 37378
At the top of your SQL code, try adding set fmtonly off
.
In some circumstances, SQL Server tries to determine the metadata for a query without actually running the query... but, this doesn't play well with temp tables. Adding set fmtonly off
instructs it to actually execute the query to get the metadata.
Upvotes: 2