Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server Thinks Temp Table Ref is for a Column Name??

Status
Not open for further replies.

Coder7

Programmer
Oct 29, 2002
224
US
I am executing the following query in query analizer and I get an error on the line doing the insert (line 10):
Server: Msg 207, Level 16, State 3, Line 10
Invalid column name '#shd_evalids'.

Could someone please help me as to why this is occurring?

Thanks as always.

-------------------------------
IF EXISTS
(SELECT NAME
FROM TEMPDB..SYSOBJECTS
WHERE NAME = "#shd_evalids")
DROP TABLE #shd_evalids

CREATE TABLE #shd_evalids
([tx_id] int
,[qa_date] datetime
,[qa_rep_tso_id] varchar(10))

/*-------------------------------------*/
INSERT INTO #shd_evalids
SELECT tx_id, qa_date, qa_rep_tso_id
FROM STATIC_HEADER_DATA AS shd
WHERE eval_id = 'mss01' and created_date < '5/8/3'


DROP TABLE #shd_evalids
 
I don't think it's that INSERT INTO line that's throwing the error - I don't see anything wrong with it.

In your check for existence at the top, use single quotes to delimit the value rather than double quotes:

Code:
WHERE name = '#shd_evalids'

--James
 
Thanks James......stupid error........I copied that code from a stored procedure that I wrote where I needed the double quotes.

Have a great week!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top