deek
SSCommitted
Points: 1886
More actions
March 1, 2004 at 2:19 pm
#178232
for instance, i want a query to take a different course depending on whether a number passed to it is even, odd, or a multiple of 3. how would you check for this?
mccork
SSC-Insane
Points: 22288
March 1, 2004 at 2:27 pm
#496534
declare @x int
set @x = 54321
if @x % 2 = 1 -- odd
print 'Odd'
else -- even
print 'Even'
if @x % 3 = 0 -- divisible by 3
print 'Divisible by 3'
Cheers,- Mark
March 1, 2004 at 2:42 pm
#496538
thanks! that's just it
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply