|
Posted by Neil on 05/15/06 19:26
Thanks.
"Erland Sommarskog" <esquel@sommarskog.se> wrote in message
news:Xns97C480ADED55Yazorman@127.0.0.1...
> Neil (nospam@nospam.net) writes:
>> Can one use Truncate Table on a linked server table? When I try it, I
>> get a message that only two prefixes are allowed. Here's what I'm
>> using:
>>
>> Truncate Table svrname.dbname.dbo.tablename
>
> I guess the error message answers your question.
>
> There is also a good reason for this not being permitted. Truncate Table
> is a special operation, that may not make sense on some other data source.
> Remember that a linked server does not have to be SQL Server.
>
> If you are on SQL 2005, you can say:
>
> EXEC('TRUNCATE TABLE dbname.dbo.tablename') AT svrname
>
> On earlier versions of SQL Server you are probably better off using DELETE
> instead, although it could possible to do it with OPENQUERY.
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|