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 a column in a Row

Author  Topic 

Ramu27
Starting Member

2 Posts

Posted - 2010-07-27 : 14:08:57
I want to update a column called AYG in a table by name PGY.

How to do update the value in this column by name AYG to 0 using SQL Server Enterprise manager 2005?

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-07-27 : 14:10:26
[code]
update PGY
set AYG = 0
from PGY
[/code]
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-27 : 14:14:06
quote:
Originally posted by slimt_slimt


update PGY
set AYG = 0
from PGY



No need for that FROM clause but maybe a need for a WHERE clause


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-07-27 : 14:17:32
you can use only:

UPDATE PGY
SET AYG = 0

or even

UPDATE PGY
SET AYG = 0
FROM PGY
WHERE AYG = {some_condition}
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-27 : 14:19:05
or even
UPDATE PGY
SET AYG = 0
FROM PGY
WHERE AYG = {some_condition}



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Ramu27
Starting Member

2 Posts

Posted - 2010-07-27 : 14:22:47
Thanks for the script, Where do I enter this script? Sort of new to SQL Server 2005. Have used 2000 before, which was pretty simple. Please clarify
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-27 : 14:27:31
In SQL Server Management Studio in a query window.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-07-27 : 14:43:01
or even so :D
both are correct :D
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-27 : 15:24:02
Use osql

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

kashyap_sql
Posting Yak Master

174 Posts

Posted - 2010-07-28 : 09:00:05
nice

With Regards
Kashyap M
Go to Top of Page
   

- Advertisement -