0

I have two databases one remote and the local ... the remote db has an ip address lets say

      Data Source = 172.16.10.118;
      Database    = AGD;
      user id     = payrol;
      password    = p_11t@x123

I tried this below but did not work

   USE [172.16.10.118]
   GO

   SELECT [AGD].dbo.[AID]
      ,[UID]
      ,[VoteCode]
   FROM [dbo].[Assignments]
   GO

.. how do i solve this riddle

Thom A
  • 88,727
  • 11
  • 45
  • 75
Miiro Bels
  • 27
  • 2
  • You need to create a linked server, and then use 4 part naming. `USE [172.16.10.118]` would attempt to use a *database* called `172.16.10.118` on the instance you are connected to, not change the context of the instance. – Thom A May 06 '23 at 15:44
  • Here's the doc: https://learn.microsoft.com/en-us/sql/relational-databases/linked-servers/create-linked-servers-sql-server-database-engine?view=sql-server-ver16 – David Browne - Microsoft May 06 '23 at 15:47

0 Answers0