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
 Update Table to replace a value

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2011-01-05 : 12:55:44

Working with one table. I want to change a value of a field depending on the value in that field.

Table Name: arcusfil
Field: userfld

This doesn't seem to work:

update arcusfil
set userfld = 'P'
where userfld = '000'

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-01-05 : 13:00:03
what do yo mean by not working ... does it give any error? or what ?
Go to Top of Page

Vack
Aged Yak Warrior

530 Posts

Posted - 2011-01-05 : 13:12:38
I get 0 rows affected.
Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-01-05 : 13:19:01
Seems there is no row with UserfID='000'?

Check:
Select * from arcusfil where UserfID='000'

does the above query returns any info?
Go to Top of Page

Vack
Aged Yak Warrior

530 Posts

Posted - 2011-01-05 : 13:55:05
Yeah The field was actually '000000' the extra zeros were not showign on the screen.

It worked.

Thanks,
Go to Top of Page
   

- Advertisement -