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
 Transact-SQL (2000)
 Incorrect syntax near '\'. error mesage

Author  Topic 

alejo46
Posting Yak Master

157 Posts

Posted - 2012-05-23 : 13:48:45
Good afternon

i've got this query and on the code when im trying to reference a table from another instance it yields me an error:Incorrect syntax near '\'. error message
In order to make sure what the right name of the instance is i run this sentence:

Use Master
go
Select @@Servername
--TRAFICO\TRAFICOSQL -- Output

but when i reference that instance in the left outer join (last 2 lines of code) the error message appear: Incorrect syntax near '\'., so here the code is:

select c.cod_cliente,c.nombre_cliente,ha.cod_abonado,ha.num_celular,p.cod_plantarif,p.descripcion,hm.valor_mora,
p.total_minutos,htllpc.num_celular2
from clientes c inner join hechos_abonados ha on c.cod_cliente = ha.cod_cliente
left outer join plan_tarifario p on ha.cod_plantarif=p.cod_plantarif
left outer join hechos_mora_abonados hm on ha.cod_abonado= hm.cod_abonado
left outer join TRAFICO\TRAFICOSQL.trafico1.dbo.hechos_trafico_llamadas_prepago_celular_201203 htllpc on ha.cod_abonado=htllpc.cod_abonado

what may i be doing wrong ?
Id appreciate your help in advance

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-05-23 : 14:07:02
Put it in side of brackets
left outer join [TRAFICO\TRAFICOSQL].trafico1

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

alejo46
Posting Yak Master

157 Posts

Posted - 2012-05-24 : 15:59:27
i've enclosed it in brackets [TRAFICO\TRAFICOSQL].trafico1 but it yields me an error:

Could not find server 'TRAFICO\TRAFICOSQL' in sysservers. Execute sp_addlinkedserver to add the server to sysservers.

I dont understand because both servers DATAMARTSQL and TRAFICO\TRAFICOSQL are in the same production system but no remote servers.
the only difference is one server is sqlserver 2000 and TRAFICO\TRAFICOSQL IS SQLSERVER 2008

Id appreciate your help in advance
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-05-25 : 08:15:33
You'll still need to add in the linked server. I'd put the link to DATAMARTSQL in to TRAFICO\TRAFICOSQL

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -