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
 how to update all the values of column

Author  Topic 

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2008-03-21 : 08:47:19
hi, i have column salary in my table emp.
my column values are as follows:

salary:
20000
30000
40000
50000

so i need to update this column values in a single update statement.
so my values as follows:

salary:
10000
10000
10000
10000
so please give me example query to update this please

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-03-21 : 08:49:25
update yourtable
set salary = 10000



- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-03-21 : 08:49:55
UPDATE emp
SET salary = 10000
will change every single salary in emp to 10000

Jim
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-03-21 : 10:50:09
Sounds like lots of people are going to be surprised on payday.








CODO ERGO SUM
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-03-21 : 10:55:30
Well in that case
UPDATE emp
SET salary = 100000

Who'll notice just one 0?!
Go to Top of Page
   

- Advertisement -