Friday, March 9, 2012

Is SELECT...INTO a Linked Server possible?

SQL2K
SP3
Greetings. I can run this OK:
select top 100 * into [server.domain.com\des.dbaTest.dbo.t48]
from t48
But it actually creates/ inserts the table into the DB I run it from (with
the name "server.domain.com\des.dbaTest.dbo.t48"), NOT onto my Linked Server
as desired. Is this not possible? I have read that this should work:
select top 100 * into [server.domain.com\des].[dbaTest].[dbo].[t48]
from t48
but I get the message:
Server: Msg 117, Level 15, State 1, Line 2
The object name 'server.domain.com\des.dbaTest.dbo.' contains more than the
maximum number of prefixes. The maximum is 2.
TIA, ChrisRDoes this work for you ?
select top 100 * from [server.domain.com\des].[dbaTest].[dbo].[t48]
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:A8519D87-D753-44F9-B289-8680BE071186@.microsoft.com...
> SQL2K
> SP3
> Greetings. I can run this OK:
> select top 100 * into [server.domain.com\des.dbaTest.dbo.t48]
> from t48
> But it actually creates/ inserts the table into the DB I run it from (with
> the name "server.domain.com\des.dbaTest.dbo.t48"), NOT onto my Linked
> Server
> as desired. Is this not possible? I have read that this should work:
> select top 100 * into [server.domain.com\des].[dbaTest].[dbo].[t48]
> from t48
> but I get the message:
> Server: Msg 117, Level 15, State 1, Line 2
> The object name 'server.domain.com\des.dbaTest.dbo.' contains more than
> the
> maximum number of prefixes. The maximum is 2.
> TIA, ChrisR|||No, I get the message:
Server: Msg 117, Level 15, State 1, Line 2
The object name 'server.domain.com\des.dbaTest.dbo.' contains more than the
maximum number of prefixes. The maximum is 2.
"Hassan" <hassan@.hotmail.com> wrote in message
news:u6gNU99$HHA.3848@.TK2MSFTNGP05.phx.gbl...
> Does this work for you ?
> select top 100 * from [server.domain.com\des].[dbaTest].[dbo].[t48]
>
> "ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
> news:A8519D87-D753-44F9-B289-8680BE071186@.microsoft.com...
>> SQL2K
>> SP3
>> Greetings. I can run this OK:
>> select top 100 * into [server.domain.com\des.dbaTest.dbo.t48]
>> from t48
>> But it actually creates/ inserts the table into the DB I run it from
>> (with
>> the name "server.domain.com\des.dbaTest.dbo.t48"), NOT onto my Linked
>> Server
>> as desired. Is this not possible? I have read that this should work:
>> select top 100 * into [server.domain.com\des].[dbaTest].[dbo].[t48]
>> from t48
>> but I get the message:
>> Server: Msg 117, Level 15, State 1, Line 2
>> The object name 'server.domain.com\des.dbaTest.dbo.' contains more than
>> the
>> maximum number of prefixes. The maximum is 2.
>> TIA, ChrisR
>|||Hi Chris
What is your linked server called?
The new table created with the INTO clause does not support 4 part names.
You would need to create the table and then use INSERT..SELECT to populate it.
John
"ChrisR" wrote:
> No, I get the message:
> Server: Msg 117, Level 15, State 1, Line 2
> The object name 'server.domain.com\des.dbaTest.dbo.' contains more than the
> maximum number of prefixes. The maximum is 2.
>
> "Hassan" <hassan@.hotmail.com> wrote in message
> news:u6gNU99$HHA.3848@.TK2MSFTNGP05.phx.gbl...
> > Does this work for you ?
> >
> > select top 100 * from [server.domain.com\des].[dbaTest].[dbo].[t48]
> >
> >
> > "ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
> > news:A8519D87-D753-44F9-B289-8680BE071186@.microsoft.com...
> >> SQL2K
> >> SP3
> >>
> >> Greetings. I can run this OK:
> >>
> >> select top 100 * into [server.domain.com\des.dbaTest.dbo.t48]
> >> from t48
> >>
> >> But it actually creates/ inserts the table into the DB I run it from
> >> (with
> >> the name "server.domain.com\des.dbaTest.dbo.t48"), NOT onto my Linked
> >> Server
> >> as desired. Is this not possible? I have read that this should work:
> >>
> >> select top 100 * into [server.domain.com\des].[dbaTest].[dbo].[t48]
> >> from t48
> >>
> >> but I get the message:
> >>
> >> Server: Msg 117, Level 15, State 1, Line 2
> >> The object name 'server.domain.com\des.dbaTest.dbo.' contains more than
> >> the
> >> maximum number of prefixes. The maximum is 2.
> >>
> >> TIA, ChrisR
> >
> >
>
>|||Thanks!
"John Bell" wrote:
> Hi Chris
> What is your linked server called?
> The new table created with the INTO clause does not support 4 part names.
> You would need to create the table and then use INSERT..SELECT to populate it.
> John
> "ChrisR" wrote:
> > No, I get the message:
> >
> > Server: Msg 117, Level 15, State 1, Line 2
> > The object name 'server.domain.com\des.dbaTest.dbo.' contains more than the
> > maximum number of prefixes. The maximum is 2.
> >
> >
> >
> > "Hassan" <hassan@.hotmail.com> wrote in message
> > news:u6gNU99$HHA.3848@.TK2MSFTNGP05.phx.gbl...
> > > Does this work for you ?
> > >
> > > select top 100 * from [server.domain.com\des].[dbaTest].[dbo].[t48]
> > >
> > >
> > > "ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
> > > news:A8519D87-D753-44F9-B289-8680BE071186@.microsoft.com...
> > >> SQL2K
> > >> SP3
> > >>
> > >> Greetings. I can run this OK:
> > >>
> > >> select top 100 * into [server.domain.com\des.dbaTest.dbo.t48]
> > >> from t48
> > >>
> > >> But it actually creates/ inserts the table into the DB I run it from
> > >> (with
> > >> the name "server.domain.com\des.dbaTest.dbo.t48"), NOT onto my Linked
> > >> Server
> > >> as desired. Is this not possible? I have read that this should work:
> > >>
> > >> select top 100 * into [server.domain.com\des].[dbaTest].[dbo].[t48]
> > >> from t48
> > >>
> > >> but I get the message:
> > >>
> > >> Server: Msg 117, Level 15, State 1, Line 2
> > >> The object name 'server.domain.com\des.dbaTest.dbo.' contains more than
> > >> the
> > >> maximum number of prefixes. The maximum is 2.
> > >>
> > >> TIA, ChrisR
> > >
> > >
> >
> >
> >

No comments:

Post a Comment