var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: 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)
The errors are: incorrect syntax near the word THEN
Any help would be greatly appreciated...
CASE WHEN (RIGHT(dbo.[000 Financial Reporting Map].[Mdse Sales], 5)) = 'Sales'
THEN dbo.GL_Account_Balances_All.[PTD Amt] * - 1
With kind regards . . . . . SQL Server 2000/2005/2012
Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages