sql server - Can the SQL Case Statment fall through? -
Is there a way to use C # in the C # statement in case statement in SQL? What I do not want to do, is the example given below, but if my only option I think I will go with it. Example:
Example:
  @NewValue = Case WHEN @MyValue = '1' THEN CAST (@MyValue as int) WHEN @MyValue = '2' then cast (@MyValue As int) ELSE NULL END   Edit:
I am using SQL Server.
To answer your specific question: No, it can not be.
 For example, see. Each  WHEN  should have  THEN result , and there is no way around it.  THEN  is not marked as an optional. It also applies to all other RDBMS used by me. 
Here's another example:
You have a good alternative way to deploy as a comment, so I do not repeat it here.
Comments
Post a Comment