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.
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 1Line 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].PersonUIDSET APTLocal.dbo.[User].PersonUID = "999999"WHERE APTLive.dbo.Employer.EmployerUID= '1252191'; |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
|
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.EmployeeON 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].PersonUIDWHERE APTLive.dbo.Employer.EmployerUID= '1252191'; |
|
|
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.EmployeeON 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].PersonUIDWHERE APTLive.dbo.Employer.EmployerUID= '1252191';
Go with alias for tables so its less confusing. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-18 : 09:11:49
|
[code]UPDATE uSET u.PersonUID = '999999'FROM APTLocal.dbo.[User] AS uINNER JOIN APTLive.dbo.Person AS p ON p.PersonUID = u.PersonUIDINNER JOIN APTLive.dbo.Employee AS e ON e.PersonUID = p.PersonUIDINNER JOIN APTLive.dbo.Employer AS x ON x.EmployerUID = e.EmployerUIDWHERE x.EmployerUID = '1252191'[/code] E 12°55'05.63"N 56°04'39.26" |
|
|
|
|
|