adumas77
asked on
select into remote table
Hi... I'm getting an error in trying to execute the following:
select * into destinationservername.data base.[owne r].new_tab lename from tablename
Any ideas in how to fix it?
select * into destinationservername.data
Any ideas in how to fix it?
Also, please maintain your many open questions. For the record:
Questions Asked 18
Last 10 Grades Given A A A A A A A A A
Question Grading Record 9 Answers Graded / 9 Answers Received
Thanks,
Anthony
Questions Asked 18
Last 10 Grades Given A A A A A A A A A
Question Grading Record 9 Answers Graded / 9 Answers Received
Thanks,
Anthony
ASKER
The object name 'destinationservername.dat abase.dbo. ' contains more than the maximum number of prefixes. The maximum is 2.
Is "destinationservername" a linked server? If not try linking (check out the stored Procedure sp_addlinkedserver) this server to the current database.
Anthony
Anthony
1."SELECT INTO" will not work, in your case
-------------------------
2. use "INSERT INTO"
----------------------
3. from destinationservername
select * into #t from openquery(sourceservername ,'select * from pubs..authors')
-------------------------
2. use "INSERT INTO"
----------------------
3. from destinationservername
select * into #t from openquery(sourceservername
ASKER
Eugene, thanks for the reply, but I'm a little lost on the syntax you provided....
Taking your example, what is #t refer to: (the destination linked server name?)
select * into #t from openquery(sourceservername ,'select * from pubs..authors')
Taking your example, what is #t refer to: (the destination linked server name?)
select * into #t from openquery(sourceservername
You should be able to use the
'destinationservername.dat abase.dbo. TABLENAME' syntax
but perhaps you haven't started the Distributed Transaction Coordinator in SQL (it's under the Support Services folder)?
'destinationservername.dat
but perhaps you haven't started the Distributed Transaction Coordinator in SQL (it's under the Support Services folder)?
--1. We run it on Destination server
----------
--2. 'SourceServerName' - linked server
---on destination server
--I use for this example #Temporary Table - you can use: -----or temp. or perm. table on Destination server
SELECT * INTO #TempTable
FROM
OPENQUERY(SourceServerName ,'SELECT * FROM pubs..authors')
----------
--2. 'SourceServerName' - linked server
---on destination server
--I use for this example #Temporary Table - you can use: -----or temp. or perm. table on Destination server
SELECT * INTO #TempTable
FROM
OPENQUERY(SourceServerName
There are some SQL commands that do not accept linked servers. "Truncate Table" and User Defined Functions also come to mind. You may want to look at workarounds, such as reversing the order of the linked servers:
select * into new_tablename from sourceservername.database. [owner].ta blename
Anthony
select * into new_tablename from sourceservername.database.
Anthony
Workaround - use DTS?
ASKER
Thanks all for the replies, but I need to run the script from the source server;
and I need to use truncate table among other things
and I need to use truncate table among other things
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ispaleny has the right source regarding the list of statements that can be executed against linked servers.
Also, please do not forget your many open questions. You will find experts more responsive if you do so. Here are listed your open questions:
https://www.experts-exchange.com/questions/20359724/Executing-other-dts-packages-within-a-package.html
https://www.experts-exchange.com/questions/20350188/Setting-action-attribute-dynamically.html
https://www.experts-exchange.com/questions/20450211/Dynamically-processing-a-cfquery-result-set.html
https://www.experts-exchange.com/questions/20369302/Oracle-Stored-Procedure.html
https://www.experts-exchange.com/questions/20369303/Oracle-Stored-Procedure-Passing-back-a-value.html
The following questions do not have any contributions and should be deleted. Post a message in Community Support at https://www.experts-exchange.com/Community_Support/ to this effect:
https://www.experts-exchange.com/questions/20390760/Insert-from-SQLServer-into-Oracle.html
https://www.experts-exchange.com/questions/20330670/RE-Simulate-a-tab-key-press-Additional-feature-needed.html
Thanks,
Anthony
Also, please do not forget your many open questions. You will find experts more responsive if you do so. Here are listed your open questions:
https://www.experts-exchange.com/questions/20359724/Executing-other-dts-packages-within-a-package.html
https://www.experts-exchange.com/questions/20350188/Setting-action-attribute-dynamically.html
https://www.experts-exchange.com/questions/20450211/Dynamically-processing-a-cfquery-result-set.html
https://www.experts-exchange.com/questions/20369302/Oracle-Stored-Procedure.html
https://www.experts-exchange.com/questions/20369303/Oracle-Stored-Procedure-Passing-back-a-value.html
The following questions do not have any contributions and should be deleted. Post a message in Community Support at https://www.experts-exchange.com/Community_Support/ to this effect:
https://www.experts-exchange.com/questions/20390760/Insert-from-SQLServer-into-Oracle.html
https://www.experts-exchange.com/questions/20330670/RE-Simulate-a-tab-key-press-Additional-feature-needed.html
Thanks,
Anthony
adumas77:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
No comment has been added to this question in more than 268 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: ispaleny http:#8169655
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
monosodiumg
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: ispaleny http:#8169655
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
monosodiumg
EE Cleanup Volunteer
Anthony