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

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to increment a variable in CASE statement

Author  Topic 

SharadD
Starting Member

4 Posts

Posted - 2008-08-22 : 06:15:16
Can I increment a variable in a CASE statement

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2008-08-22 : 06:39:06
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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-22 : 09:55:57
may be this is what he meant

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

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-08-22 : 10:00:43
quote:
Originally posted by SharadD

Can I increment a variable in a CASE statement


Yes

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -