Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Executing querys in distributed server

Executing querys in distributed server

Scheduled Pinned Locked Moved Database
databasesql-serversysadmin
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vipin d
    wrote on last edited by
    #1

    Hi frndz, In my machine, I have a MSSQL server named "Local" with one database "TEST1" and in server machine there is also one MSSQL server named "Sever" with one database named "TEST" with table "Tbl" My doubt is,is it possible to excute "select * from TEST.Tbl" query from query analyser of "local"'. Thanks in advance

    All I ever wanted is what others have....
    CrazySanker

    P 1 Reply Last reply
    0
    • V Vipin d

      Hi frndz, In my machine, I have a MSSQL server named "Local" with one database "TEST1" and in server machine there is also one MSSQL server named "Sever" with one database named "TEST" with table "Tbl" My doubt is,is it possible to excute "select * from TEST.Tbl" query from query analyser of "local"'. Thanks in advance

      All I ever wanted is what others have....
      CrazySanker

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      If you set up a linked server, you should be able to query databases on this server using the syntax server.database.owner.table

      Paul Marfleet

      V 1 Reply Last reply
      0
      • P pmarfleet

        If you set up a linked server, you should be able to query databases on this server using the syntax server.database.owner.table

        Paul Marfleet

        V Offline
        V Offline
        Vipin d
        wrote on last edited by
        #3

        Thank u for your reply. I setup the linked server command like EXEC sp_addlinkedserver 'server name', N'SQL Server' select * from [server name].[TEST].[dbo].[Tbl] but it shows error like Server: Msg 18452, Level 14, State 1, Line 7 Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

        All I ever wanted is what others have....
        CrazySanker

        P 1 Reply Last reply
        0
        • V Vipin d

          Thank u for your reply. I setup the linked server command like EXEC sp_addlinkedserver 'server name', N'SQL Server' select * from [server name].[TEST].[dbo].[Tbl] but it shows error like Server: Msg 18452, Level 14, State 1, Line 7 Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

          All I ever wanted is what others have....
          CrazySanker

          P Offline
          P Offline
          pmarfleet
          wrote on last edited by
          #4

          If you are adding the linked server dynamically in code, you should call the sp_addlinkedsrvlogin SP to set up the login credentials required to access the linked server. Specify a SQL Server login if you can't access the linked server using a trusted connection. If the server you are connecting to isn't an instance of SQL Server, you can use the OPENQUERY function to execute a pass-through query against the server.

          Paul Marfleet

          V 1 Reply Last reply
          0
          • P pmarfleet

            If you are adding the linked server dynamically in code, you should call the sp_addlinkedsrvlogin SP to set up the login credentials required to access the linked server. Specify a SQL Server login if you can't access the linked server using a trusted connection. If the server you are connecting to isn't an instance of SQL Server, you can use the OPENQUERY function to execute a pass-through query against the server.

            Paul Marfleet

            V Offline
            V Offline
            Vipin d
            wrote on last edited by
            #5

            Hi pmarfleet , Thanks for your reply.Now I got the solution. I add this as linked server through Enterprise manager->security->linked server when i tried this "exec sp_addlinkedserver" SP,it shows some problem. anyway now its working fine..:) Thank you once again for spending time for me!!!

            All I ever wanted is what others have....
            CrazySanker

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups