Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    13

    Unanswered: sp_AddLINKEDSERVER DB Name ISSUE

    HI!

    i m using sp_ADDLINKEDSERVER for getting data from the other server name 'db\test'.

    And when i write

    '
    EXEC SP_ADDLINKEDSERVER 'db\test', 'SQL SERVER'
    GO

    EXEC sp_addlinkedsrvlogin 'db\test', FALSE ,NULL ,'sa','sa'
    GO

    SELECT * FROM db\test.Practice.DBO.Employees
    '

    And then run it in query analyzer. it gives following error due to '\' in the server name.

    Incorrect syntax near '\'.

    how to resolve this issue?

    Regards,
    Shabber Abbas Rizvi.

  2. #2
    Join Date
    Nov 2005
    Posts
    13

    Another try

    I also tried [] with server name.

    like

    SELECT * FROM [db\test].Practice.DBO.Employees

    but it also doesn't work.
    Last edited by shabberabbas; 12-06-05 at 02:31.

  3. #3
    Join Date
    Jun 2003
    Posts
    269

    Question

    Quote Originally Posted by shabberabbas
    I also tried [] with server name.

    like

    SELECT * FROM [db\test].Practice.DBO.Employees

    but it also doesn't work.
    what error u getting when u tried that query?
    I love cursor,though I never use it.Cos' I dont want to misuse it.
    ----------------------------------------------

    ----cheers
    ----http://mallier.blogspot.com

  4. #4
    Join Date
    Nov 2005
    Posts
    13
    I get following error.

    Incorrect syntax near '\'.

    Regards,
    Shabber.

  5. #5
    Join Date
    Mar 2003
    Location
    Reading, UK
    Posts
    70
    Why dont you try like this,
    this works fine for me..

    exec sp_addlinkedserver 'db_test','','SQLOLEDB','<server-name>'

    exec sp_addlinkedsrvlogin 'db_test',false,'sa','sa','test'

    select * from db_test.<db-name>.dbo.<table-name>

    Pavan Kashyap.

  6. #6
    Join Date
    Mar 2003
    Location
    Indiana, USA
    Posts
    100
    Ignore my answer was wrong

    Tim S
    Last edited by TimS; 12-07-05 at 17:41.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •