Strange situation

  • Hi,

    I received a database which as a view.

    This view as the following code:

    SELECT TOP (100) PERCENT rf.repf_id, p.prov_id, p.prov_num, p.prov_dsg, rf.repf_num_rf, rf.repf_dsg, rf.repf_num_rf + '-' + rf.repf_dsg AS RFNumDsg,

    dbo.tbl_Base_RepFiscalAux.rfaux_nivel, dbo.tbl_Base_TipoServicoFiscal.tpsf_id, dbo.tbl_Base_TipoServicoFiscal.tpsf_abrev,

    dbo.tbl_Base_TipoServicoFiscal.tpsf_dsg

    FROM dbo.tbl_Base_TipoServicoFiscal RIGHT OUTER JOIN

    dbo.tbl_Base_RepFiscalAux ON dbo.tbl_Base_TipoServicoFiscal.tpsf_id = dbo.tbl_Base_RepFiscalAux.rfaux_tpsf_id RIGHT OUTER JOIN

    dbo.tbl_Base_Provincia AS p RIGHT OUTER JOIN

    (SELECT repf_id, repf_prov_id, repf_num_rf, repf_dsg

    FROM dbo.tbl_Base_RepFiscal

    UNION

    SELECT 0 AS repf_id, 0 AS repf_prov_id, '----' AS repf_num_rf, ' Seleccione o Serviço' AS repf_dsg) AS rf ON p.prov_id = rf.repf_prov_id ON

    dbo.tbl_Base_RepFiscalAux.rfaux_num_rf = rf.repf_num_rf

    ORDER BY p.prov_num, rf.repf_num_rf

    Then i try to execute this view on my server, SQL Server 2005 (MS) tell's me that it can not find the server nwsrv2 in sys.servers....

    I am runing this query in my server. In the SQL statement i don't see any reference to a server.

    How can this happen?

    Thank you

  • Is one of your tables actually also a view, and the server name is hardcoded in there ?

  • Didn't undestood your question...

  • i have deleted all the tables that where called by this view, still same error...

  • One of the "tables" is probably actually a view, or one of them has a computed column that references a view or UDF. That's where you'll find the linked server being referenced.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • hum.... that's right. One of the tables was a view...

    Thank you very much

  • You're welcome.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply