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 Administration (2000)
 Spot the incorrect syntax please..!

Author  Topic 

smemflynn
Starting Member

10 Posts

Posted - 2008-12-18 : 07:25:07
With the below code, I keep on getting the following error:

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '('.

Can anyone spot the problem please..?! Thanks!

UPDATE ((APTLive.dbo.Person INNER JOIN APTLive.dbo.Employee
ON APTLive.dbo.Person.PersonUID = APTLive.dbo.Employee.PersonUID)
INNER JOIN APTLive.dbo.Employer ON APTLive.dbo.Employee.EmployerUID = APTLive.dbo.Employer.EmployerUID)
INNER JOIN APTLocal.dbo.[User] ON APTLive.dbo.Person.PersonUID = APTLocal.dbo.[User].PersonUID
SET APTLocal.dbo.[User].PersonUID = "999999"
WHERE APTLive.dbo.Employer.EmployerUID= '1252191';

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-12-18 : 07:29:13
Asked and answered:
http://www.sqlservercentral.com/Forums/Topic621947-5-1.aspx

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

smemflynn
Starting Member

10 Posts

Posted - 2008-12-18 : 07:36:25

This worked perfect:

UPDATE APTLocal.dbo.[User]SET PersonUID = '999999'
FROM ((APTLive.dbo.Person INNER JOIN APTLive.dbo.Employee
ON APTLive.dbo.Person.PersonUID = APTLive.dbo.Employee.PersonUID)
INNER JOIN APTLive.dbo.Employer ON APTLive.dbo.Employee.EmployerUID = APTLive.dbo.Employer.EmployerUID)
INNER JOIN APTLocal.dbo.[User] ON APTLive.dbo.Person.PersonUID = APTLocal.dbo.[User].PersonUID
WHERE APTLive.dbo.Employer.EmployerUID= '1252191';
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-12-18 : 09:02:03
quote:
Originally posted by smemflynn


This worked perfect:

UPDATE APTLocal.dbo.[User]SET PersonUID = '999999'
FROM ((APTLive.dbo.Person INNER JOIN APTLive.dbo.Employee
ON APTLive.dbo.Person.PersonUID = APTLive.dbo.Employee.PersonUID)
INNER JOIN APTLive.dbo.Employer ON APTLive.dbo.Employee.EmployerUID = APTLive.dbo.Employer.EmployerUID)
INNER JOIN APTLocal.dbo.[User] ON APTLive.dbo.Person.PersonUID = APTLocal.dbo.[User].PersonUID
WHERE APTLive.dbo.Employer.EmployerUID= '1252191';



Go with alias for tables so its less confusing.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-18 : 09:11:49
[code]UPDATE u
SET u.PersonUID = '999999'
FROM APTLocal.dbo.[User] AS u
INNER JOIN APTLive.dbo.Person AS p ON p.PersonUID = u.PersonUID
INNER JOIN APTLive.dbo.Employee AS e ON e.PersonUID = p.PersonUID
INNER JOIN APTLive.dbo.Employer AS x ON x.EmployerUID = e.EmployerUID
WHERE x.EmployerUID = '1252191'[/code]


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -