Hi,
I have an Update SQL query, which works in MS SQL Server.
The tables concerned are dbo_Contacts which has a Primary Key ContactID and is linked to another table dbo_Location with a foreign key LocationID.
There are columns in both these tables called Current, which is datatype char(1) and holds either "Y" or "N" for is current or is not current.
Now I have a process that updates the Current column in Locations table. I need to update all the corresponding Contacts by joining on the Foreign Key, LocationID, that are marked dbo_Locations.[Current] = "N" in the Locations table.
The Query is as follows.
update dbo_Contacts
set dbo_Contacts.[Current] = 'N'
from dbo_Contacts c
inner join dbo_Locations l on c.LocationID = l.LocationID
where l.[Current] = 'N'
and c.FirstName is not null
and c.LastName is not null
I am trying to use this query in Access 2010. The issue is I'm getting a syntax error:
Syntax error (missing operator) in query Expression "N'
from
dbo_Contacts c
inner join
dbo_Locations l
on
c.LocationID = l.LocationID'.
Any sort of help is more than welcome and thank you is advance!
-Avi
I have an Update SQL query, which works in MS SQL Server.
The tables concerned are dbo_Contacts which has a Primary Key ContactID and is linked to another table dbo_Location with a foreign key LocationID.
There are columns in both these tables called Current, which is datatype char(1) and holds either "Y" or "N" for is current or is not current.
Now I have a process that updates the Current column in Locations table. I need to update all the corresponding Contacts by joining on the Foreign Key, LocationID, that are marked dbo_Locations.[Current] = "N" in the Locations table.
The Query is as follows.
update dbo_Contacts
set dbo_Contacts.[Current] = 'N'
from dbo_Contacts c
inner join dbo_Locations l on c.LocationID = l.LocationID
where l.[Current] = 'N'
and c.FirstName is not null
and c.LastName is not null
I am trying to use this query in Access 2010. The issue is I'm getting a syntax error:
Syntax error (missing operator) in query Expression "N'
from
dbo_Contacts c
inner join
dbo_Locations l
on
c.LocationID = l.LocationID'.
Any sort of help is more than welcome and thank you is advance!
-Avi