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

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Truncate table on Linked Server

Author  Topic 

rnadesan
Starting Member

2 Posts

Posted - 2003-10-14 : 14:37:28
Hi Folks,

I have stored procedure trying to truncate a table on linked server.

This is sql syntax:

TRUNCATE TABLE server01.database01.dbo.Tablename01

I get this error:

Server: Msg 117, Level 15, State 1, Line 2
The object name 'server01.database01.dbo.' contains more
than the maximum number of prefixes. The maximum is 2.


Your advice and input will be greatly appreciated.

Thanks and have a nice

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-14 : 15:36:53
Apparently TRUNCATE TABLE is not allowed against a linked server. TRUNCATE TABLE only allows the 2-part naming convetion: OwnerName.ObjectName

Instead of TRUNCATE TABLE:

DELETE FROM server01.database01.dbo.Tablename01

Tara
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-10-15 : 00:58:04
or maybe

exec server01.database01.dbo.sp_executesql 'truncate table Tablename01'

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -