<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Disable CHECK Constraint &#8211; Enable CHECK Constraint</title>
	<atom:link href="http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 17 May 2013 15:26:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: dhanalakshmi</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-474945</link>
		<dc:creator><![CDATA[dhanalakshmi]]></dc:creator>
		<pubDate>Tue, 14 May 2013 07:47:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-474945</guid>
		<description><![CDATA[use swathy2
create table paydept( emp_id int  check(emp_id&gt;0),firstnam varchar(50),lastnam varchar(50))
insert into paydept values(&#039;1&#039;, &#039;jam&#039;,&#039;varatha&#039;)
select * from paydept
insert into paydept values(&#039;2&#039;, &#039;dhana&#039;, &#039;lakshmi&#039;)
Alter table paydept
drop check emp_id


in this table for dropping the table error is coming

like Incorrect syntax near the keyword &#039;check&#039;.

please give me the reply how do i drop the check in this table]]></description>
		<content:encoded><![CDATA[<p>use swathy2<br />
create table paydept( emp_id int  check(emp_id&gt;0),firstnam varchar(50),lastnam varchar(50))<br />
insert into paydept values(&#8217;1&#8242;, &#8216;jam&#8217;,'varatha&#8217;)<br />
select * from paydept<br />
insert into paydept values(&#8217;2&#8242;, &#8216;dhana&#8217;, &#8216;lakshmi&#8217;)<br />
Alter table paydept<br />
drop check emp_id</p>
<p>in this table for dropping the table error is coming</p>
<p>like Incorrect syntax near the keyword &#8216;check&#8217;.</p>
<p>please give me the reply how do i drop the check in this table</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manqoba</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-451859</link>
		<dc:creator><![CDATA[Manqoba]]></dc:creator>
		<pubDate>Mon, 08 Apr 2013 16:16:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-451859</guid>
		<description><![CDATA[Hi,
I am currently a student at a University of Technology. I would like to know if I don&#039;t want to delete, is it possible to &quot;freeze/disable&quot; a record in sql server 2008 R2?]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
I am currently a student at a University of Technology. I would like to know if I don&#8217;t want to delete, is it possible to &#8220;freeze/disable&#8221; a record in sql server 2008 R2?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sinisa</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-383787</link>
		<dc:creator><![CDATA[Sinisa]]></dc:creator>
		<pubDate>Fri, 30 Nov 2012 09:06:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-383787</guid>
		<description><![CDATA[I did it when I had to import several related tables and didn&#039;t want to bother with order of the importing. It was from one server, file transfer, flat file import...and since the files were different sizes, they arrived in different order so I disabled every check and simply imported the files as they arrived.

@iDesi, it&#039;s not typo, it works exactly as written]]></description>
		<content:encoded><![CDATA[<p>I did it when I had to import several related tables and didn&#8217;t want to bother with order of the importing. It was from one server, file transfer, flat file import&#8230;and since the files were different sizes, they arrived in different order so I disabled every check and simply imported the files as they arrived.</p>
<p>@iDesi, it&#8217;s not typo, it works exactly as written</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: iDesi</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-377490</link>
		<dc:creator><![CDATA[iDesi]]></dc:creator>
		<pubDate>Tue, 20 Nov 2012 14:40:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-377490</guid>
		<description><![CDATA[There&#039;s a typo in your blog entry. &quot;World CHECK is used twice&quot; should be &quot;word&quot;. A very helpful blog though. :)]]></description>
		<content:encoded><![CDATA[<p>There&#8217;s a typo in your blog entry. &#8220;World CHECK is used twice&#8221; should be &#8220;word&#8221;. A very helpful blog though. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: iDesi</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-377488</link>
		<dc:creator><![CDATA[iDesi]]></dc:creator>
		<pubDate>Tue, 20 Nov 2012 14:39:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-377488</guid>
		<description><![CDATA[There&#039;s a typo in your blog post. &quot;World CHECK is used twice&quot; should be &quot;word&quot;. Very helpful blog though :)]]></description>
		<content:encoded><![CDATA[<p>There&#8217;s a typo in your blog post. &#8220;World CHECK is used twice&#8221; should be &#8220;word&#8221;. Very helpful blog though :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #003 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-375246</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #003 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 17 Nov 2012 01:31:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-375246</guid>
		<description><![CDATA[[...] Enable or Disable Constraint  This is very simple script but I personally keep on forgetting it so I had blogged it. Till today, I keep on referencing this again and again as sometime a very little thing is hard to remember. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Enable or Disable Constraint  This is very simple script but I personally keep on forgetting it so I had blogged it. Till today, I keep on referencing this again and again as sometime a very little thing is hard to remember. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: babuni</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-351698</link>
		<dc:creator><![CDATA[babuni]]></dc:creator>
		<pubDate>Fri, 21 Sep 2012 06:55:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-351698</guid>
		<description><![CDATA[hi pinal 
i was using this query to disable my check constraint and it is done successfully but while i wanted to enable this one it is showing an error saying that
The ALTER TABLE statement conflicted with the CHECK constraint &quot;ck_address_emp&quot;. The conflict occurred in database
please solve it...]]></description>
		<content:encoded><![CDATA[<p>hi pinal<br />
i was using this query to disable my check constraint and it is done successfully but while i wanted to enable this one it is showing an error saying that<br />
The ALTER TABLE statement conflicted with the CHECK constraint &#8220;ck_address_emp&#8221;. The conflict occurred in database<br />
please solve it&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: D-wanna</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-350493</link>
		<dc:creator><![CDATA[D-wanna]]></dc:creator>
		<pubDate>Tue, 18 Sep 2012 15:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-350493</guid>
		<description><![CDATA[When re-enabling the constraints, it&#039;s imperative that you tell SQL Server to check the existing population:
ALTER TABLE HumanResources.Employee WITH CHECK CHECK CONSTRAINT ALL;
(Note that the double CHECK is *not* a typo!)

Failing to do so, as in your code, makes the constraints non-trusted. The optimizer will now no longer use these constraints to optimize execution plans.

More info at http://sqlblog.com/blogs/hugo_kornelis/archive/2007/03/29/can-you-trust-your-constraints.aspx]]></description>
		<content:encoded><![CDATA[<p>When re-enabling the constraints, it&#8217;s imperative that you tell SQL Server to check the existing population:<br />
ALTER TABLE HumanResources.Employee WITH CHECK CHECK CONSTRAINT ALL;<br />
(Note that the double CHECK is *not* a typo!)</p>
<p>Failing to do so, as in your code, makes the constraints non-trusted. The optimizer will now no longer use these constraints to optimize execution plans.</p>
<p>More info at <a href="http://sqlblog.com/blogs/hugo_kornelis/archive/2007/03/29/can-you-trust-your-constraints.aspx" rel="nofollow">http://sqlblog.com/blogs/hugo_kornelis/archive/2007/03/29/can-you-trust-your-constraints.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hao</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-341679</link>
		<dc:creator><![CDATA[hao]]></dc:creator>
		<pubDate>Fri, 07 Sep 2012 05:55:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-341679</guid>
		<description><![CDATA[correct!]]></description>
		<content:encoded><![CDATA[<p>correct!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sudhakar</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-321811</link>
		<dc:creator><![CDATA[sudhakar]]></dc:creator>
		<pubDate>Mon, 30 Jul 2012 12:10:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-321811</guid>
		<description><![CDATA[Hi,

     I need to alter a column datatype. so i have disabled all the constraints which are depending on the column. But still i could not run the alter statement. It gives 
Msg 5074, Level 16, State 1, Line 1
The object &#039;FK_something&#039; is dependent on column &#039;ALIAS&#039;.

But if i run this script

SELECT name, tbl = object_name(parent_obj)
FROM sysobjects
WHERE objectproperty(id, &#039;CnstIsDisabled&#039;) = 1

it shows all the constrains which i was disabled.

any one help me!]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>     I need to alter a column datatype. so i have disabled all the constraints which are depending on the column. But still i could not run the alter statement. It gives<br />
Msg 5074, Level 16, State 1, Line 1<br />
The object &#8216;FK_something&#8217; is dependent on column &#8216;ALIAS&#8217;.</p>
<p>But if i run this script</p>
<p>SELECT name, tbl = object_name(parent_obj)<br />
FROM sysobjects<br />
WHERE objectproperty(id, &#8216;CnstIsDisabled&#8217;) = 1</p>
<p>it shows all the constrains which i was disabled.</p>
<p>any one help me!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikhildas</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-281552</link>
		<dc:creator><![CDATA[Nikhildas]]></dc:creator>
		<pubDate>Thu, 03 May 2012 05:08:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-281552</guid>
		<description><![CDATA[Thanks pinal sir..

Its very helpful...]]></description>
		<content:encoded><![CDATA[<p>Thanks pinal sir..</p>
<p>Its very helpful&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sanju</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-263535</link>
		<dc:creator><![CDATA[Sanju]]></dc:creator>
		<pubDate>Fri, 16 Mar 2012 05:17:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-263535</guid>
		<description><![CDATA[There is no mistake in your &#039;check&#039; but if you check your text, there is some mistake.

Let us have a look...
 &quot;.... the world CHECK is used twice – WITH CHECK CHECK CONSTRAINT&quot; 

Just go before the first check, world... it should be word but not world... ;)

I know, its not a technical discussion but still a suggestion to correct it.. :)]]></description>
		<content:encoded><![CDATA[<p>There is no mistake in your &#8216;check&#8217; but if you check your text, there is some mistake.</p>
<p>Let us have a look&#8230;<br />
 &#8220;&#8230;. the world CHECK is used twice – WITH CHECK CHECK CONSTRAINT&#8221; </p>
<p>Just go before the first check, world&#8230; it should be word but not world&#8230; ;)</p>
<p>I know, its not a technical discussion but still a suggestion to correct it.. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Various Ways to Create Constraints &#8211; Quiz &#8211; Puzzle &#8211; 17 of 31 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-239875</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Various Ways to Create Constraints &#8211; Quiz &#8211; Puzzle &#8211; 17 of 31 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Wed, 18 Jan 2012 01:31:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-239875</guid>
		<description><![CDATA[[...] Creating Table Creating Primary Key, Foreign Key and Default Constraint How to ALTER CONSTRAINT Disable CHECK Constraint – Enable CHECK Constraint Query to Display Foreign Key Relationships and Name of the Constraint for Each Table in Database [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Creating Table Creating Primary Key, Foreign Key and Default Constraint How to ALTER CONSTRAINT Disable CHECK Constraint – Enable CHECK Constraint Query to Display Foreign Key Relationships and Name of the Constraint for Each Table in Database [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Golden</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-233537</link>
		<dc:creator><![CDATA[Golden]]></dc:creator>
		<pubDate>Sun, 08 Jan 2012 13:21:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-233537</guid>
		<description><![CDATA[I am updating the tables in 13 databases on my one application. Many of them reffering to each other. I have disabled the constraints, updated tables and enabled. 

Just I want to know if any impact on database health by doing this changes in constraints.

Response required.

Thanks
AKHILESH]]></description>
		<content:encoded><![CDATA[<p>I am updating the tables in 13 databases on my one application. Many of them reffering to each other. I have disabled the constraints, updated tables and enabled. </p>
<p>Just I want to know if any impact on database health by doing this changes in constraints.</p>
<p>Response required.</p>
<p>Thanks<br />
AKHILESH</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Senthil Kumar K.S</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-218427</link>
		<dc:creator><![CDATA[Senthil Kumar K.S]]></dc:creator>
		<pubDate>Thu, 15 Dec 2011 11:24:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-218427</guid>
		<description><![CDATA[How to check status of column constraint ( enabled or disabled)]]></description>
		<content:encoded><![CDATA[<p>How to check status of column constraint ( enabled or disabled)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Senthil Kumar K.S</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-218417</link>
		<dc:creator><![CDATA[Senthil Kumar K.S]]></dc:creator>
		<pubDate>Thu, 15 Dec 2011 11:02:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-218417</guid>
		<description><![CDATA[How to check status of column constraints.(Enable or disabled).]]></description>
		<content:encoded><![CDATA[<p>How to check status of column constraints.(Enable or disabled).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jayaram</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-164633</link>
		<dc:creator><![CDATA[Jayaram]]></dc:creator>
		<pubDate>Fri, 02 Sep 2011 05:30:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-164633</guid>
		<description><![CDATA[How to maintain check constraint with two databases say db1 and db2?]]></description>
		<content:encoded><![CDATA[<p>How to maintain check constraint with two databases say db1 and db2?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KumarHarsh</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-91713</link>
		<dc:creator><![CDATA[KumarHarsh]]></dc:creator>
		<pubDate>Thu, 07 Oct 2010 11:07:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-91713</guid>
		<description><![CDATA[Hi,
Suppose,I disable the index.
Perform some task
Again I enable it.
when I enable the index again whether the data will be reindexed or it will remain same.
If it gets reindexed how long will it take to reindex for 13 crore / 130 million record.


Thanks.]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
Suppose,I disable the index.<br />
Perform some task<br />
Again I enable it.<br />
when I enable the index again whether the data will be reindexed or it will remain same.<br />
If it gets reindexed how long will it take to reindex for 13 crore / 130 million record.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niraj Singh Pawar</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-80913</link>
		<dc:creator><![CDATA[Niraj Singh Pawar]]></dc:creator>
		<pubDate>Tue, 20 Jul 2010 11:08:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-80913</guid>
		<description><![CDATA[how to use Check constraint in If conditions]]></description>
		<content:encoded><![CDATA[<p>how to use Check constraint in If conditions</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Anthony</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-57560</link>
		<dc:creator><![CDATA[Ryan Anthony]]></dc:creator>
		<pubDate>Thu, 12 Nov 2009 21:15:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-57560</guid>
		<description><![CDATA[You don&#039;t need to use With Check when re-enabling a check constraint, it accomplishes something entirely different than re-enabling the check constraint.  By default for Alter Table, With Nocheck is used for re-enabling check constraints.  Specifying With Check looks at all existing data to make sure it satisfies the check constraint.  If you can safely assume that it already does, then you don&#039;t need to specify that.

I disable check constraints to get replicating dbs that have gotten out of sync back in sync.]]></description>
		<content:encoded><![CDATA[<p>You don&#8217;t need to use With Check when re-enabling a check constraint, it accomplishes something entirely different than re-enabling the check constraint.  By default for Alter Table, With Nocheck is used for re-enabling check constraints.  Specifying With Check looks at all existing data to make sure it satisfies the check constraint.  If you can safely assume that it already does, then you don&#8217;t need to specify that.</p>
<p>I disable check constraints to get replicating dbs that have gotten out of sync back in sync.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Tkatch</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-57553</link>
		<dc:creator><![CDATA[Brian Tkatch]]></dc:creator>
		<pubDate>Thu, 12 Nov 2009 14:19:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-57553</guid>
		<description><![CDATA[@Dave so you disabled the NOT NULL CONSTRAINT?

@Imran So you disable the FK.

I think FK is the most likely CONSTRAINT to be disabled, and NOT NULL being a close second. A CHECK CONSTRAINT (not the one for NOT NULL which although is a CHECK CONSTRAINT, is specified differently) is not really disabled too often.

It would be interesting to see what types a CHECK CONSTRAINT are actually used, and which types are disabled.]]></description>
		<content:encoded><![CDATA[<p>@Dave so you disabled the NOT NULL CONSTRAINT?</p>
<p>@Imran So you disable the FK.</p>
<p>I think FK is the most likely CONSTRAINT to be disabled, and NOT NULL being a close second. A CHECK CONSTRAINT (not the one for NOT NULL which although is a CHECK CONSTRAINT, is specified differently) is not really disabled too often.</p>
<p>It would be interesting to see what types a CHECK CONSTRAINT are actually used, and which types are disabled.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-57534</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Thu, 12 Nov 2009 04:20:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-57534</guid>
		<description><![CDATA[I remember, We had a huge database that collects statistics around 45 GB and we had very less space on server, it created many problems.

Finally one fine day, they asked me if I could help, they said, they want to clean historical data. Vendor suggested them to use front End to Purge (Delete) data. It was like tons of records... and would take for ever more than a day, to purge data, because you could purge very few records at one time.

I studied their database and came to conclusion that there are only 3 tables that had huge amount of data... and other tables were referring to them. 

I gave them a solution to Truncate those 3 tables. For that I had to drop foreign key constraint. I dropped Forign Key Constraint, Truncated tables and built Foreign Key constraint again. 

Boom... 3 seconds... Database size came to less than 0.5 GB.

Result: I was awarded DBA of the week :)

Note: I did enough research on the database, and I ensured that truncating data from 3 tables wont effect application. 

~ IM.]]></description>
		<content:encoded><![CDATA[<p>I remember, We had a huge database that collects statistics around 45 GB and we had very less space on server, it created many problems.</p>
<p>Finally one fine day, they asked me if I could help, they said, they want to clean historical data. Vendor suggested them to use front End to Purge (Delete) data. It was like tons of records&#8230; and would take for ever more than a day, to purge data, because you could purge very few records at one time.</p>
<p>I studied their database and came to conclusion that there are only 3 tables that had huge amount of data&#8230; and other tables were referring to them. </p>
<p>I gave them a solution to Truncate those 3 tables. For that I had to drop foreign key constraint. I dropped Forign Key Constraint, Truncated tables and built Foreign Key constraint again. </p>
<p>Boom&#8230; 3 seconds&#8230; Database size came to less than 0.5 GB.</p>
<p>Result: I was awarded DBA of the week :)</p>
<p>Note: I did enough research on the database, and I ensured that truncating data from 3 tables wont effect application. </p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/#comment-57530</link>
		<dc:creator><![CDATA[Dave]]></dc:creator>
		<pubDate>Thu, 12 Nov 2009 02:23:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7198#comment-57530</guid>
		<description><![CDATA[I have disabled FKs in the past for purposes of data loading, where data coming into constrained column was going to have nulls.

After loading and cleaning the constraints were re-enabled.]]></description>
		<content:encoded><![CDATA[<p>I have disabled FKs in the past for purposes of data loading, where data coming into constrained column was going to have nulls.</p>
<p>After loading and cleaning the constraints were re-enabled.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
