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
 Circular reference to update

Author  Topic 

DuaneMIS
Starting Member

3 Posts

Posted - 2008-04-25 : 20:30:50
I have a table like the following
Table=Items
Type / Name
3 / Active Item
3 / Active Item
4 / New Item
4 / New Item
5 / Old Item
5 / Old Item

How do I run a querry to update the Type Colum entrys from 5's to 3's? I have tried the following:
UPDATE Items SET Type = 3 WHERE Type = 5

The above querry passes SQL Querry analyzer, but the querry itself provides the following error: Unable to parse query text.
I think the error is due to the fact that I am using a circular reference to update the same Column that I am testing on.
MS-SQL 2005 SP-2

Any help would be FANTASTIC!

cat_jesus
Aged Yak Warrior

547 Posts

Posted - 2008-04-25 : 23:02:46
Did you try putting single quotes around your values?

An infinite universe is the ultimate cartesian product.
Go to Top of Page

DuaneMIS
Starting Member

3 Posts

Posted - 2008-04-25 : 23:42:59
Have tried with NO quotes, and then quoting each seperately as well as together.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-26 : 02:10:05
I cant spot any oibvious errors. Whats the data type of Type column?
Go to Top of Page

DuaneMIS
Starting Member

3 Posts

Posted - 2008-04-26 : 02:18:45
Data Type is set to Int

When I tried quoting I was using single quotes '
Go to Top of Page
   

- Advertisement -