Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 truncate a table on a linked server
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

3 Posts

Posted - 10/17/2012 :  16:21:56  Show Profile  Reply with Quote
I’m trying to truncate a table on a linked server. I’ve given myself all possible permissions on the linked server.
I can run:
SELECT * FROM linkedServer.import.dbo.SafetyStockTime
But when I run:
TRUNCATE TABLE linkedServer.import.dbo.SafetyStockTime
I get the error:
Cannot find the object "SafetyStockTime" because it does not exist or you do not have permissions.
So I know it exists, and I’ve assigned myself all possible permissions. Any help as to what I'm missing??

Almighty SQL Goddess

38200 Posts

Posted - 10/17/2012 :  16:48:11  Show Profile  Visit tkizer's Homepage  Reply with Quote
You can't truncate a table over a linked server since truncate is DDL and not DML. You'll need to use delete instead or connect to the server directly rather than through the linked server.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server

Subscribe to my blog
Go to Top of Page

Most Valuable Yak

15732 Posts

Posted - 10/17/2012 :  18:51:47  Show Profile  Visit robvolk's Homepage  Reply with Quote
One option you can try is to create a stored procedure on the linked server that performs the TRUNCATE TABLE, then execute it via 4-part name:

EXEC linkedServer.import.dbo.TruncateProcedure

In SQL Server 2008 (not sure about previous versions), you can use the AT clause of the EXECUTE command:

EXEC ('TRUNCATE TABLE import.dbo.TruncateProcedure') AT linkedServer

See Books Online for more details under "EXECUTE".
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000