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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CASE statement with WHEN EXISTS 1

Status
Not open for further replies.

kermitforney

Technical User
Mar 15, 2005
374
US
What is wrong with my statement ? ? ? Keep getting an
Code:
"Msg 156, Level 15, State 1, Line 13
Incorrect syntax near the keyword 'AS'."
error.
Code:
SELECT	*
		,CASE 
			WHEN EXISTS(
							SELECT *
							FROM tblStores
							WHERE lngDivisionID IN (	
														SELECT lngDivisionID 
														FROM tblDivisions 
														WHERE lngOperatingCompanyID = 9
													)
								AND tntRecordStatus = 0
						)
			THEN YTDSSS * .02 AS monSuppliesMax
		
INTO #tmp2
		
FROM #tmp



Any suggestions?

 
Every case must have an END.

[tt][blue]
THEN YTDSSS * .02 [!]End[/!] AS monSuppliesMax
[/blue][/tt]

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
I feel like such an idiot right now. :(

Definitely as case of the Mondays.

Thanks again, gm!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top