ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ADODB from SQLServer - IF function? (https://www.excelbanter.com/excel-programming/320582-re-adodb-sqlserver-if-function.html)

onedaywhen[_2_]

ADODB from SQLServer - IF function?
 
Dianne Butterworth wrote:
Googling suggests things like IF, IIF, DECODE, CASE, but I can't seem

to put
these into practice.


Just to clarify, the ANSI standard SQL syntax is CASE, which is
supported in SQL Server, so you should use it:

http://msdn.microsoft.com/library/de...ca-co_5t9v.asp

DECODE is proprietary Oracle syntax. IIF is proprietary Jet (MS Access)
syntax. For portability (in the loosest sense) it is best to use the
standard syntax but this is not always possible e.g. Jet does not
support CASE.

Jamie.

--


Dianne Butterworth[_2_]

ADODB from SQLServer - IF function?
 
Jamie,

I had tried CASE, but hadn't realised it required an END.

Thanks for the pointer to the MSDN article. I have bookmarked this for
future TSQL queries -- very useful!

--
Dianne

onedaywhen wrote:
Dianne Butterworth wrote:
Googling suggests things like IF, IIF, DECODE, CASE, but I can't
seem to put these into practice.


Just to clarify, the ANSI standard SQL syntax is CASE, which is
supported in SQL Server, so you should use it:

http://msdn.microsoft.com/library/de...ca-co_5t9v.asp

DECODE is proprietary Oracle syntax. IIF is proprietary Jet (MS
Access) syntax. For portability (in the loosest sense) it is best to
use the standard syntax but this is not always possible e.g. Jet does
not support CASE.

Jamie.





All times are GMT +1. The time now is 05:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com