473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Multiple conditions in "IF" statement in T-SQL?

Hi All,

Just wondering if anyone can tell me if you can test for multiple
conditions as part of an "IF" statement in T-SQL in SQL Server 2000?

ie something like:

IF @merr = 1 or @merr=2
Begin
SELECT statement
UPDATE statement
End

Any help much appreciated!

Much warmth,

M.
Jul 20 '05 #1
1 66837
M Wells (pl**********@planetthoughtful.org) writes:
Just wondering if anyone can tell me if you can test for multiple
conditions as part of an "IF" statement in T-SQL in SQL Server 2000?

ie something like:

IF @merr = 1 or @merr=2
Begin
SELECT statement
UPDATE statement
End


Yes you can.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: LRW | last post by:
I'm not exactly sure how to even ask the question, and I know my terminology is not good as I'm a SQL beginner, but, here goes. I need to find a way to make an if statement within an array...or,...
9
by: Scott Beavers | last post by:
I'm trying to create a form in Excel to sort from the form and take the data to another worksheet. I am very new to this and any help would be appreciated. I have a value in a cell that will...
40
by: Steve Juranich | last post by:
I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a "n00b". I dutifully evangelize on the...
3
by: gamerman0203 | last post by:
I'm new to asp so this could be an obvious answer. how would I write and "if-then-else" statement in vbscript for my asp pages? what I'm doing is pulling data from an access db and displaying...
35
by: David Cleaver | last post by:
Hello all, I was wondering if there were some sort of limitations on the "if" statement? I'm writing a program which needs to check a bunch of conditions all at the same time (basically). And...
6
by: Jacob.Bruxer | last post by:
Hi, I'm pretty new to Visual Basic and programming in general. I want to know if it's possible to create an If statement that asks if a value is an integer. If it's an integer it does one thing,...
2
by: marsarden | last post by:
write code like: int main(void) { int a=10; if(a<20) {} } Compiler ok on dev-cpp . don't we have to add a ";" after if
2
by: ibukhari | last post by:
Hi, I have a question regarding a optimization in if statement in C. Which one is more optimised in the following. Is the assembly generated by compiler is differant for both cases? Is the machine...
3
by: johnssc | last post by:
Would like to know if I'm correct in the way I coded this: <% If CheckFileExists("http://www.xxx.com/us/images/products/'" & IName & "'.jpg") Then %> <img...
7
by: seegoon | last post by:
Hi guys. I'm trying to write some php so that, depending on the page displayed, a certain <div> will load a certain class, giving it a certain background image. I have it down in theory, but...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.