title: How to perform Multiple If statement inside Case statement of SQL Server
body: <p>I want to create multiple if else statement inside the case of sql server.
  Is it possible then please provide me one example.
  In c# you can write the multi line statement inside the case.</p>
  
  <p>Is it possible in SQL Server like C# switch case.</p>
  
  <p>I want to put below code in case  loop</p>
  
  <pre><code>IF @SegmentId &gt; 0 and @AttributeName IS NOT NULL   
  begin
    select AttributeID,Attribute_key from AttributeMaster 
    where AttributeTypeId =@AttributeType and SegmentId=@SegmentId 
    and Attribute_key   like '%'+@AttributeName+'%' order by AttributeID
  end
  
  else IF @SegmentId = 0 and NULLIF(@AttributeName, '') IS NULL   
  begin
    select AttributeID,Attribute_key from AttributeMaster 
    where AttributeTypeId =@AttributeType  order by AttributeID
  end
  
  else IF @SegmentId &gt; 0 and NULLIF(@AttributeName, '') IS NULL   
  begin
    select AttributeID,Attribute_key from AttributeMaster 
    where AttributeTypeId =@AttributeType and SegmentId=@SegmentId  
    order by AttributeID
  end
  </code></pre>
  
  <p>I need to implement the <code>@AttributeTypeId</code> is 1 then different condition. <code>my@AttributeId</code> from <code>1 to 5</code></p>