April 5th, 2012, 09:47 AM
Trying to execute another if, else statement
I’m trying to execute a query that will look at the column “Account_Type” and say if
If account type field is Other Current Asset, Other Current Liability, Accounts Payable, Accounts Receivable, Bank, Fixed Asset, Credit Card, Long term Liability, Other asset, Equity then ZLMOVTYPE = ‘F99’ and If account type field is Cost of Goods Sold, Income, Expense, Other Expense, Other Income then ZLMOVTYPE=‘PL99’, Else null.
This is what I got just trying to test on one item and I get error, what should it be?
select case when Account_Type = (Accounts Payable),
end AS ZLMOVETYPE
April 5th, 2012, 12:37 PM
select case when Account_Type = 'Accounts Payable'
then ‘F99' else NULL end AS ZLMOVETYPE
April 5th, 2012, 01:08 PM
Thanks, I executed that code and got the following:
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '‘'.
Msg 105, Level 15, State 1, Line 2
Unclosed quotation mark after the character string ' else NULL end AS ZLMOVETYPE
April 5th, 2012, 03:24 PM
that's one o' them thar microsoft curly quotes
Originally Posted by mark1906
replace it with a regular single quote -- on most keyboards it's between the semicolon and the enter key