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
 General SQL Server Forums
 New to SQL Server Programming
 truncate table problem

Author  Topic 

mavericky
Posting Yak Master

117 Posts

Posted - 2011-07-22 : 22:16:19
Hi All,
If I want to truncate a table, is it necessary that all its FK constrains with its dependencies must be dropped?

Thanks,
Mavericky

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2011-07-22 : 22:27:41
If you ultimate goal is to use TRUNCATE then yes, can't do it if it is referenced by FKs

Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-23 : 04:04:02
you can get the same effect by using DELETE FROM TABle also even when FK is present but then you need to make sure no references is present in any of child tables and also it takes more time because of level of logging

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

mavericky
Posting Yak Master

117 Posts

Posted - 2011-07-23 : 07:25:38
Thanks for the replies guys. It was helpful.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-23 : 08:11:47
you're welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -