The THEN statement specifies the action if the WHEN condition returns TRUE. The WHEN statement specifies the condition to be tested. The SQL Server CASE Statement consists of at least one pair of WHEN and THEN statements. The CASE statement is used to implement the logic where you want to set the value of one column depending upon the values in other columns. In this article, we would explore the SQL CASE statement and its various use cases. We mostly use a case expression in SQL stored procedures or as a formula for a particular column that optimizes the SQL statements. It tests a list of conditions and returns one of the multiple possible results. The CASE statement in SQL returns a value for the condition specified.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |