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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update table SET RowA=0 Where RowB=1

Author  Topic 

alissababa
Starting Member

5 Posts

Posted - 2007-09-04 : 17:59:21
Hello, I would like to change all the names in a certian row is 1 to 0.
I've done this stuff :
Update TableName SET RowA=0 Where RowA=1


But this is what I got :
Invalid Column name "0"


Can you help me please?
Thanks////

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-04 : 18:10:31
Is RowA column integer or varchar?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

alissababa
Starting Member

5 Posts

Posted - 2007-09-05 : 03:36:10
that was a wrong example I guess.
I would like to do this instead :
Update TableName SET RowA=B Where RowA=A

both RowA and RowB are varchar.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-05 : 03:48:26
Update TableName SET RowA = 'B' Where RowA = 'A'



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

alissababa
Starting Member

5 Posts

Posted - 2007-09-05 : 03:56:10
Update TableName SET RowA = 'B' Where RowA = 'A'
That's what I've done in the first place.
it should work, right, there's nothing that wouldn't make it work or so....
That's weird.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-05 : 04:01:55
Are you sure you have two columns named "RowA" and "RowB" in the table "TableName"?

Maybe you should post yuor actual query here and describe what you would like to do?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

alissababa
Starting Member

5 Posts

Posted - 2007-09-05 : 06:35:31
It worked. Thanks!
the '' was the problem.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-09-05 : 06:59:07
quote:
Originally posted by alissababa

Hello, I would like to change all the names in a certian row is 1 to 0.
I've done this stuff :
Update TableName SET RowA=0 Where RowA=1


But this is what I got :
Invalid Column name "0"


Can you help me please?
Thanks////


In no case you will have such error as long as you assign numbers to the column

You would get error only if you used

Update TableName SET RowA=[0] Where RowA=1


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -