March 1, 2010 at 2:14 pm
Hello everybody,
I need to update a column in a small database running on SQL Server 2005 express and need some advice on how to go about it. The scenario is this:
The table is called 'parts' and the column is 'capacity'. The capacity column needs to have every value rounded updated to the next higher number divisible by 50. I have been looking into the round and ceiling functions but am not getting anywhere. Can somebody help?
Thank you in advance!
Jeff
March 1, 2010 at 2:43 pm
something like this?
create table temp#( capacity float)
insert into temp#
values(13.7),
(74.3),
(189.7)
update temp#
set capacity = (cast((ROUND(capacity,0)/50)as int)+1)*50
select * from temp#
drop table temp#
March 1, 2010 at 2:51 pm
Thank you, that worked out perfectly. I appreciate your help!
Jeff
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply