You are here: Re: Disabling Constraint for Bulk Loading « MsSQL Server « IT news, forums, messages
Re: Disabling Constraint for Bulk Loading

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация