running32
asked on
Error on linked server query
update upload set strmatch = 1
where (name in (select BC-DENTRIX.dbo.ddb_pat_bas e.lastname from BC-DENTRIX.dbo.ddb_pat_bas e))
and (dob in (select BC-DENTRIX.dbo.ddb_pat_bas e.birthdat e from BC-DENTRIX.dbo.ddb_pat_bas e))
and (lname in (select BC-DENTRIX.dbo.ddb_pat_bas e.firstnam e from BC-DENTRIX.dbo.ddb_pat_bas e))
I am trying to run the above query on a linked server but I am getting the message below. I would be greatful for any help on how to resolve this. Thank you
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '-'.
Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '-'.
Server: Msg 170, Level 15, State 1, Line 4
Line 4: Incorrect syntax near '-'.
where (name in (select BC-DENTRIX.dbo.ddb_pat_bas
and (dob in (select BC-DENTRIX.dbo.ddb_pat_bas
and (lname in (select BC-DENTRIX.dbo.ddb_pat_bas
I am trying to run the above query on a linked server but I am getting the message below. I would be greatful for any help on how to resolve this. Thank you
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '-'.
Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '-'.
Server: Msg 170, Level 15, State 1, Line 4
Line 4: Incorrect syntax near '-'.
or more efficient coding:
update upload
set strmatch = 1
from upload u
join [BC-DENTRIX].dbo.ddb_pat_b ase x
on x.lastname = u.name
and x.birthdatre = u.dob
and x.firstname = u.lname
update upload
set strmatch = 1
from upload u
join [BC-DENTRIX].dbo.ddb_pat_b
on x.lastname = u.name
and x.birthdatre = u.dob
and x.firstname = u.lname
ASKER
It gives me the error Invalid object name 'BC-DENTRIX.dbo.ddb_pat_ba se'. but I see the linked server BC-Dentrix in my linked server list and can see the tables through enterprise manager.
thanks
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
WONDERFUL..... THANK YOU
where (name in (select [BC-DENTRIX].dbo.ddb_pat_b
and (dob in (select [BC-DENTRIX].dbo.ddb_pat_b
and (lname in (select [BC-DENTRIX].dbo.ddb_pat_b