Monday, January 27, 2014

SQL CASE Function

DECLARE @Type varchar(20)
SET @Type = 'Programming'
SELECT 
   CASE @Type 
      WHEN 'Sql' THEN 'sqltutorials.blogspot.com' 
      WHEN 'Programming' THEN 'programmingschools.blogspot.com' 
      WHEN 'Travel' THEN 'travelyourself.blogspot.com' 
      ELSE 'Not yet categorized' 
      END


Value = programmingschools.blogspot.com





If SET @Type = 'Picture', then Return value = Not yet categorized



link : http://sqltutorials.blogspot.in/2007/06/sql-case-function.html

0 comments:

Post a Comment