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 |
alejo46
Posting Yak Master
157 Posts |
Posted - 2012-05-23 : 13:48:45
|
Good afternoni'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 messageIn order to make sure what the right name of the instance is i run this sentence: Use MastergoSelect @@Servername--TRAFICO\TRAFICOSQL -- Outputbut 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_clienteleft outer join plan_tarifario p on ha.cod_plantarif=p.cod_plantarifleft outer join hechos_mora_abonados hm on ha.cod_abonado= hm.cod_abonadoleft outer join TRAFICO\TRAFICOSQL.trafico1.dbo.hechos_trafico_llamadas_prepago_celular_201203 htllpc on ha.cod_abonado=htllpc.cod_abonadowhat 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 bracketsleft outer join [TRAFICO\TRAFICOSQL].trafico1JimEveryday I learn something that somebody else already knew |
|
|
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 2008Id appreciate your help in advance |
|
|
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 JimEveryday I learn something that somebody else already knew |
|
|
|
|
|