Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting Records from table on one server into table on another

Status
Not open for further replies.

earthandfire

Programmer
Mar 14, 2005
2,924
GB
The following code:

TRUNCATE TABLE SVUKSWIPC002513.DealerAuditData.dbo.F5W03

generates the error:

The object name 'SVUKSWIPC002513.DealerAuditData.dbo.' contains more than the maximum number of prefixes. The maximum is 2.


If I remove .dbo, it complains that it can't find a database called 'SVUKSWIPC002513, which is obviously correct since it is a server.

I've linked the server using:

EXEC sp_addlinkedserver 'SVUKSWIPC002513', N'SQL Server'

DealerAuditData is the database and F5W03 is the table.

There are around a dozen tables that I need to Truncate then rebuild using Insert Into. The code works perfectly without the linking - by saving the data in the main server.

Any advice would be greatly appreciated.

[vampire][bat]
 


Instead of using truncate, you can use delete to do the same thing.
 
Thanks for the explanation - I couldn't understand why SELECT and INSERT worked but TRUNCATE didn't.

[vampire][bat]
 

I guess command 'truncate' is not counted as a command from SQL Data Manipulation Language (DML), in DML you can refer to a remote table otherwise you can't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top