[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Invalid object name '#TEMPSTATUS'.

Posted on 2009-07-07
3
Medium Priority
?
175 Views
Last Modified: 2013-11-05
Can somebody explain to me why I am getting this error:
Invalid object name '#TEMPSTATUS'.
when i execute the query below?

SELECT DISTINCT
	I.INSTNAMENO AS NAMENO,
	I.POLICY AS LINEOFBUSINESS,
	CASE WHEN I.STATUS IN (0,1,13) THEN 'Not Started'
	ELSE CASE WHEN I.STATUS IN (2,3,4,5,6,7,14) THEN 'In Progress'
	ELSE CASE WHEN I.STATUS IN (8,9,10) THEN 'Under Review'
	ELSE CASE WHEN I.STATUS IN (11,12) THEN 'Complete'
	ELSE CASE WHEN I.STATUS IN (11,12) THEN 'Non-renewed Application'
	ELSE '' END END END END END AS PMRSTATUS,
	'EAF APPLICATION' AS TXNTYPE,
	I.YEAR AS YEAR
 
INTO #TEMPEAF
FROM UE_EAF..APPLICATION I
 
WHERE 
	I.YEAR >= DATEPART(YYYY,DATEADD(YYYY,-1,GETDATE()))
	AND I.INSTNAMENO = @NameNo
 
 
-----------------------COMBINE ALL TEMP TABLES---------------------------
SELECT DISTINCT
	T2.NAMENO,
	T2.LINEOFBUSINESS,
	T2.PMRSTATUS,
	T2.TXNTYPE,
	T2.YEAR
FROM #TEMPEAF T2
 
WHERE 
	T2.NAMENO <> 0
	AND T2.NAMENO = @NameNo
	AND T2.LINEOFBUSINESS IS NOT NULL
 
UNION
 
SELECT DISTINCT
	T.NAMENO,
	T.LINEOFBUSINESS,
	T.PMRSTATUS,
	T.TXNTYPE,
	T.YEAR
FROM #TEMPSTATUS T
 
WHERE T.NAMENO = @NameNo
	AND T.LINEOFBUSINESS IS NOT NULL
 
ORDER BY YEAR, TXNTYPE DESC
 
 
DROP TABLE #TEMPSTATUS
 
DROP TABLE #TEMPEAF
END
 
END

Open in new window

0
Comment
Question by:snazaire
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 2000 total points
ID: 24792036
you have inserted data only in #TEMPEAF

not in #TEMPSTATUS

where you are creating teh tav\ble and inserting data in #TEMPSTATUS ? like #TEMPEAF
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24792049
You are obtaining the error since you haven't created the temp table #TEMPSTATUS at all.
And you are issuing a SELECT statement in this non-existing table which error-ed out.

Kindly create that table and hope this helps
0
 

Author Comment

by:snazaire
ID: 24792069
Thank you rrjeqan17, but pratima answered already the same way.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question