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
 General SQL Server Forums
 New to SQL Server Programming
 Updating multiple rows with value of other column

Author  Topic 

Joe A
Starting Member

3 Posts

Posted - 2012-01-04 : 12:13:13
Hi all,

I have a table with 712 rows.
One column from row 545 onwards to row 712 is empty and needs to be filled with the value from another column in the same row. On top of this, this value needs to be multiplied by 0.0672.

So, there is a column called 'Nitrogen' which (from row 545 until 712) needs to be filled with the value * 0.0672 from the column called 'Humus' in the same row.

Can anybody provide me with an answer?
Thanks very much,

Joe A

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-04 : 12:17:50
[code]
UPDATE tablename
SET Nitrogen= Humus* 0.0672
WHERE Nitrogen IS NULL
OR Nitrogen =''
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Joe A
Starting Member

3 Posts

Posted - 2012-01-05 : 04:44:10
Thanks!
Go to Top of Page

Joe A
Starting Member

3 Posts

Posted - 2012-01-05 : 04:54:41
Thanks you very much. That worked quite well!

quote:
Originally posted by visakh16


UPDATE tablename
SET Nitrogen= Humus* 0.0672
WHERE Nitrogen IS NULL
OR Nitrogen =''


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-05 : 09:26:34
you're welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -