September 4, 2007 at 12:36 am
Hello All,
How would you Update the rows which are divisible by 10, given a set of numbers in column?
Regards,
Ganapathi M
September 4, 2007 at 12:46 am
Ganapathi,
somthing like this should work:
Update
myTable
Set col1 = Col1 + 5 -- Put your new value here
where Col2%10 = 0
Markus
[font="Verdana"]Markus Bohse[/font]
September 5, 2007 at 4:16 am
Thanks Markus,
Its Working!!!
Ganapathi.
September 5, 2007 at 6:20 am
Ganapathi,
It's good that the code works... but do you know WHY it works?
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2007 at 1:02 am
Oh well, I tried... looks like yet another newbie got what they wanted but not what they needed... knowledge
Peso, ol' friend... if you read this, looks like you were right... new breed of Yak is taking over
--Jeff Moden
Change is inevitable... Change for the better is not.
September 10, 2007 at 8:12 am
Must have been a homework assignment!
Steve
September 10, 2007 at 8:46 am
10/2 = 5
10%2 = 0
% is called Modulo division. It will gives us the Quotient value. In our example
Quotient is 0 suppose if i give 11/2 then output will be '1'.
The same logic is applied in the update statement.
Jeff, am i correct ?
Sblock, i cannot do my assignment in my school days.
Regards,
Ganapathi
September 10, 2007 at 2:39 pm
Yep... you've got it... just wanted to make sure
--Jeff Moden
Change is inevitable... Change for the better is not.
September 10, 2007 at 3:21 pm
Just curious, what practical application did you need this for. The question sounded more like something you would use in an academic situation and therefore my suspicion that it was for homework. Sorry.
Steve
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply