1
select 
    *
into
    [Server1].[MyDB].[dbo].[_ListClientBEBRUT]
from
    [Server2].[MyDB].[dbo].[_ListClientBEBRUT]

But it returns me an error :

Msg 117, Level 15, State 1, Line 126
The object name 'Server1.MyDB.dbo._ListClientBEBRUT' contains more than the maximum number of prefixes. The maximum is 2.

Could you please tell me how i can fix it?

KeusT
  • 105
  • 8
  • https://stackoverflow.com/questions/26119343/the-object-name-contains-more-than-the-maximum-number-of-prefixes-the-maximum-i – Arzybek Mar 15 '22 at 13:04
  • 1
    4-part naming is `server.database.schema.object` - are you trying to copy your table into another schema, another database, or another server? – Aaron Bertrand Mar 15 '22 at 13:06
  • An other server year you're right – KeusT Mar 15 '22 at 13:09
  • `dbo` is your schema here, *not* your linked servers that are oddly called `Schema1` and `Schema2`. – Thom A Mar 15 '22 at 13:12
  • Read the [documentation](https://learn.microsoft.com/en-us/sql/t-sql/queries/select-into-clause-transact-sql?view=sql-server-ver15) - "You cannot create new_table on a remote server;" – SMor Mar 15 '22 at 15:01

1 Answers1

1

Server1.MyDb.dbo._ListClientBEBRUT is the server.db.schema.table where I want to copy my data from Server2.MyDb.dbo._ListClientBEBRUT

  1. Connect on the destination server in the correct data base (in my ex : Server1.MyDb)
  2. Run this query

select 
    *
into
    _ListClientBEBRUT
from
    [Server2].[MyDB].[dbo].[_ListClientBEBRUT]

Some usefull links :

Stack overflow answer

Microsoft documentation

KeusT
  • 105
  • 8