Select Into across Linked Servers

Hi. I'm trying to copy from one table to another across 2 different
servers with the following:

select *
into #Tmp_Hdr
from parsaleshdr
where businessday = '9/20/07'

select *
into [pdsqla01\pdsqla01].impact_exec.dbo.parsaleshdr
from #Tmp_Hdr

This gives me an error:
The object name 'pdsqla01\pdsqla01.impact_exec.dbo.' contains more
than the maximum number of prefixes. The maximum is 2.

Not really sure how to get around it. I was trying to use OpenQuery,
but that's really for selecting from, not into. How can I get around
this?

Thanks,
Jennifer
J.Evans.1970 [ Do, 27 September 2007 17:38 ] [ ID #1830549 ]

Re: Select Into across Linked Servers

Jennifer (J.Evans.1970 [at] gmail.com) writes:
> Hi. I'm trying to copy from one table to another across 2 different
> servers with the following:
>
> select *
> into #Tmp_Hdr
> from parsaleshdr
> where businessday = '9/20/07'
>
> select *
> into [pdsqla01\pdsqla01].impact_exec.dbo.parsaleshdr
> from #Tmp_Hdr
>
> This gives me an error:
> The object name 'pdsqla01\pdsqla01.impact_exec.dbo.' contains more
> than the maximum number of prefixes. The maximum is 2.
>
> Not really sure how to get around it. I was trying to use OpenQuery,
> but that's really for selecting from, not into. How can I get around
> this?

You need to create the table on the remote server in advance.


--
Erland Sommarskog, SQL Server MVP, esquel [at] sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downlo ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books .mspx
Erland Sommarskog [ Fr, 28 September 2007 23:43 ] [ ID #1831528 ]
Datenbanken » comp.databases.ms-sqlserver » Select Into across Linked Servers

Vorheriges Thema: find unique identifier through multiple tables
Nächstes Thema: Network Packet Size