Solved

Else Do nothing

Posted on 2006-10-31
3
1,307 Views
Last Modified: 2008-02-26
I have T-SQL code that goes through a bunch of IF - ELSE statements, at the end I would like to say ELSE do nothing. How do I do that?
0
Comment
Question by:MorDeRor
3 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 17842215
Just dont specify the 'ELSE' clause


IF 1= 1
SELECT 1
0
 
LVL 11

Expert Comment

by:Otana
ID: 17842218
Just don't include the ELSE part, it's not mandatory.

For example:

IF @test = 1
  BEGIN
    SELECT * FROM Table1
  END
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 17842271
>>bunch of IF - ELSE statements

if Cond1
Stmt1
else
     if Cond2
      Stmt2
      else
           if cond3
           Stmt3
 
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how the fundamental information of how to create a table.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question