Wednesday 16 March 2011

Using the IIF command in Microsoft SQL



A little nitty problem of today I want to document. Basically came up with this command in an old Access Database


IIf([Length]=True,"Twelve Months"

Now, there is no IIf command in Microsoft SQL Statments, so this command needs to be converted to :


CASE
WHEN [Length]=1 THEN 'Twelve Months'
END

Simple!

No comments:

Post a Comment