View Single Post
  #1 (permalink)  
Old 10-29-09, 13:30
NotaDBGuru NotaDBGuru is offline
Registered User
 
Join Date: Aug 2009
Posts: 11
Conditional statement in SQL Server query

I have never written a formula in a SQL Server query before, just in Access and Oracle...

I have an "iif" satement that works great in access and I am attempting to move it to SQL Server. I have learned in these forums to use "Case" instead of "IIF" Now I am stuck.

I am running into errors when I run the following in my query:

CASE WHEN (RIGHT(dbo.[000 Financial Reporting Map].[Mdse Sales], 5) = 'Sales' THEN dbo.GL_Account_Balances_All.[PTD Amt] * - 1 ELSE '0' END)
AS Sales_Dollars

The errors are: incorrect syntax near the word THEN

Any help would be greatly appreciated...
Reply With Quote