Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to increment a variable in CASE statement
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

4 Posts

Posted - 08/22/2008 :  06:15:16  Show Profile  Reply with Quote
Can I increment a variable in a CASE statement

Flowing Fount of Yak Knowledge

United Kingdom
1074 Posts

Posted - 08/22/2008 :  06:39:06  Show Profile  Reply with Quote
Huh? By increment a variable, do you mean add 1 to it? If so, then why would you need a case statement?

set @myVariable = @myVariable + 1

Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 08/22/2008 :  09:55:57  Show Profile  Reply with Quote
may be this is what he meant

SET @Variable=CASE condition1 THEN @variable +1 ELSE some other processing END
Go to Top of Page

Flowing Fount of Yak Knowledge

6065 Posts

Posted - 08/22/2008 :  10:00:43  Show Profile  Reply with Quote
Originally posted by SharadD

Can I increment a variable in a CASE statement


Be One with the Optimizer
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000