March 20, 2009 at 3:46 pm
I have this problem deleting a table
The object name 'PRODUCCIONREPORTES.DWIcbfSimReportes.dbo.TmpConsDenunciaPeticion' contains more than the maximum number of prefixes. The maximum is 2.
Command SQL
DROP TABLE PRODUCCIONREPORTES.DWIcbfSimReportes.dbo.TmpConsDenunciaPeticion;
July 7, 2009 at 12:14 am
I am getting same problem but I have to use it....How can I do...I want to use select into..
Thanks
October 13, 2009 at 8:19 am
I found that you can prefix server name in From part.
For example, you connect to serverA
(Assuming you have added the linked serverB)
select * into [db].[owner].
from [serverB].[db].[owner].
This works.
But NOT in the one below, even you are connected to serverA:
select * into [serverA].[db].[owner].
from [serverB].[db].[owner].
This test is on SQL server 2008
October 26, 2010 at 6:57 am
I was searching for an answer for this error message and I found the following link that might help others:
http://www.sql-server-helper.com/error-messages/msg-117.aspx
January 31, 2011 at 7:28 pm
an old thread i know....but I had a similar problem trying to do a select into over a linked server. To solve the problem, I ran the following query from the target database pulling the data from the database that is on the linked server:
SELECT field1, field2, field3, field 4
INTO myDatabase.mySchema.myTable --run the query from this db, using three part naming
FROM aLinkedServer.aDatabase.aSchema.aTable --this is the db on the linked server
June 16, 2011 at 9:02 am
Assuming the servers have been set up as linked servers, you can run a query in the context of ServerB while still using a connection to ServerA (assuming having privileges on both databases and servers)
exec ServerB.DatabaseB.dbo.sp_executesql N'INSERT INTO ServerA.DatabaseA.dbo.TableA SELECT * FROM DatabaseB.dbo.TableB(or ViewB or FunctionB)'
To use with a function, you can do something similar to
exec ServerB.DatabaseB.dbo.sp_executesql N'INSERT INTO ServerA.DatabaseA.dbo.TableA SELECT * FROM DatabaseB.dbo.
FuncB(@input)',N'@input varchar(MAX)', @input='whatever'
This allows you to bypass issues when you need the 4 part name, but of course I would recommend testing your query directly on ServerB first, and then applying the above
April 27, 2012 at 10:51 am
I've also found that this works: EXEC(‘TRUNCATE TABLE [Test_DB].dbo.thisTable’) AT [Link-Server]
May 16, 2014 at 12:38 pm
One needs to use the square brackets [ ] in this case (one of the few cases when there is no escape).
So the incorrect syntax SERVER.DOMAIN.DATABASE.SCHEMA.TABLE must become
[SERVER].[DATABASE].[SCHEMA].
e.g.
SELECT TOP 1 *
FROM [MYSERVER.MYDOMAIN.MYCORP.MYCOMPANY.COM].[MYDATABASE].[dbo].[MYTABLE] ;
Viewing 8 posts - 16 through 22 (of 22 total)
You must be logged in to reply to this topic. Login to reply