Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RE: truncate table thru a link server

940 views
Skip to first unread message

John Bell

unread,
Dec 1, 2005, 1:22:03 PM12/1/05
to
Hi

You could use openquery such as

SELECT * FROM OPENQUERY(linkedServer,'TRUNCATE TABLE DBName.dbo.tablename
SELECT ''OK'';)

But you may want to wrap your processing into a stored procedure on the
remote server and process everything in the one call.

e.g on remote server
CREATE PROCEDURE usp_truncatetablename
AS
truncate table DBName.dbo.tablename

On local server

EXEC linkedServer.DBName.dbo.usp_truncatetablename

John

"culam" wrote:

> I have 2 tables with 500K and 1Million records and need TRUNCATED/LOADED
> daily. I cannot truncate thru a link server.
> Ex. TRUNCATE TABLE linkedServer.DBName.dbo.tablename
>
> I am forced to use a DELETE command, but it takes too long. Does anybody
> have a better idea or a way to truncate a table remotely.
>
> Thanks,
> Lam

0 new messages