|
Posted by Erland Sommarskog on 12/08/05 10:24
(pankaj_wolfhunter@yahoo.co.in) writes:
> Thanx for the reply. Sorry for that ASE thing.
> But one thing. in my application we have a need to truncate the SQL
> Servers table before loading data into it. I dont want to drop the
> constraints.
You can't have it both ways. Since all TRUNCATE TABLE does is to deallocate
the extents, it cannot check whether you violate any constraints. It can
only check whether there is a possibility for this to happen. I.e., there
are referencing foreign keys.
There are two options:
1) Drop constraints, truncate tables, load data, reapply constraints.
2) Do not drop constraints, and use DELETE to remove the data.
--
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]
|