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 2005 Forums
 Express Edition and Compact Edition (2005)
 UPDATE statement

Author  Topic 

kocsis.levente
Starting Member

2 Posts

Posted - 2011-10-30 : 14:45:49
Hi,

I want to write a query, which uses an internal SELECT statement:

UPDATE x
SET x.a = y.aa,
x.b= y.bb
FROM y
WHERE x.c= y.c
AND x.d = 1

It's says that's something wrong with "FROM", I think this is an sql ce 2000 statement, how is in sql 2005?

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-10-30 : 14:58:56
...
FROM y INNER JOIN x ON x.c= y.c
WHERE x.d = 1

--
Gail Shaw
SQL Server MVP
Go to Top of Page

kocsis.levente
Starting Member

2 Posts

Posted - 2011-10-31 : 01:03:06
I tried your statement.
It's says that "There was an error parsing the query", "Token in Error = FROM"

I think it's something wrong with FROM.

quote:
Originally posted by GilaMonster

...
FROM y INNER JOIN x ON x.c= y.c
WHERE x.d = 1

--
Gail Shaw
SQL Server MVP

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-31 : 02:11:10
can you post the full query that you used ?

Did you incorporating the partial query that Gail posted into your query ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-10-31 : 04:16:34
Hang on... compact edition.

I don't think it allows the update from, but I could be mistaken, never used compact. Thought you were asking for a SQL 2005 query, not a SQL 2005 CE query.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-31 : 04:36:10
oh SQL Server CE. Didn't notice that also

As SQL CE 2000 (not sure about 2005 or later) does not support UPDATE with JOINS, I remember i just loop it in my application to update.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -