CHOOSE Function On SQL Server

 

Did you know the CHOOSE function in SQL Server? This function introduced with SQL Server 2012.

The CHOOSE command can provide practical use for situations such as the example above.

For example:

Here is the CASE WHEN version of the command I wrote above with CHOOSE:

It doesn’t contribute to performance, but as I said, it makes it easy to write code.

Ekrem Önsoy
Author: Ekrem Önsoy

The original article was written in Turkish by Ekrem Önsoy and translated to English by dbtut with the consent of the author. The copyright of the article belongs to the author. The author shall not be liable in any way for any defect caused by translation.

Leave a Reply

Your email address will not be published. Required fields are marked *