Solved

Else Do nothing

Posted on 2006-10-31
3
1,328 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

685 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