Could not find server '' in sys.servers.

  • Hi All,

    i am trying to update some a table from another table in another database but am getting the following error:

    Msg 7202, Level 11, State 2, Line 2

    Could not find server 'DQMeta1' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

    this is my code:

    begin tran

    update [360MetaVerse].dbo.Country

    set AreaInContinent = [DQMeta1].[dbo].[_Country].AreaPart,

    SafeName = [DQMeta1].[dbo].[_Country].SafeName,

    CountryLongName = [DQMeta1].[dbo].[_Country].CountryLongName,

    OfficialLanguage = [DQMeta1].[dbo].[_Country].OfficialLanguage

    from [DQMeta1].[dbo].[_Country].ISOCountryCodeID

    join [DQMeta1].[dbo].[_Country] on [360MetaVerse].dbo.Country.ISOCountryCode = [DQMeta1].[dbo].[_Country].ISOCountryCodeID

    Thanks in advance

  • your problem is in the FROM part :

    [DQMeta1].[dbo].[_Country].ISOCountryCodeID

    SQL SErver interprets this as :

    [DQMeta1] : Linked server

    [dbo] : DbName

    ...

    I guess you want do this instead :

    begin tran

    update [360MetaVerse].dbo.Country

    set AreaInContinent = [DQMeta1].[dbo].[_Country].AreaPart,

    SafeName = [DQMeta1].[dbo].[_Country].SafeName,

    CountryLongName = [DQMeta1].[dbo].[_Country].CountryLongName,

    OfficialLanguage = [DQMeta1].[dbo].[_Country].OfficialLanguage

    from [360MetaVerse].dbo.Country

    join [DQMeta1].[dbo].[_Country] on [360MetaVerse].dbo.Country.ISOCountryCode = [DQMeta1].[dbo].[_Country].ISOCountryCodeID

  • yes that was it, thanks very much

  • but can you tell me why the from clause is the table i am updating? i thought it should be where the data is coming from i.e. DQMeta1

  • You can write the query as follow as well :

    update [360MetaVerse].dbo.Country

    set AreaInContinent = [DQMeta1].[dbo].[_Country].AreaPart,

    SafeName = [DQMeta1].[dbo].[_Country].SafeName,

    CountryLongName = [DQMeta1].[dbo].[_Country].CountryLongName,

    OfficialLanguage = [DQMeta1].[dbo].[_Country].OfficialLanguage

    from [DQMeta1].[dbo].[_Country]

    WHERE [360MetaVerse].dbo.Country.ISOCountryCode = [DQMeta1].[dbo].[_Country].ISOCountryCodeID

    Have a look at UPDATE syntax :

    http://msdn.microsoft.com/en-us/library/ms177523.aspx

Viewing 5 posts - 1 through 4 (of 4 total)

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