<?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"
	>
<channel>
	<title>Comments on: To delete or not to delete</title>
	<atom:link href="http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/</link>
	<description>development in a land far far away...</description>
	<pubDate>Thu, 21 Aug 2008 18:18:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>By: Michael Sharman</title>
		<link>http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-47482</link>
		<dc:creator>Michael Sharman</dc:creator>
		<pubDate>Sun, 27 Apr 2008 20:42:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-47482</guid>
		<description>@Sohbet - Normally I'd create a column in my table called something like "bIsDeleted" (the 'b' standing for boolean).

The datatype in MSSQL would be 'bit', but for MySQL I'd typically use 'tinyint'. I would only store a '0' or '1' in this column.

When I want to delete that row I simply UPDATE its value to '1' meaning true, or yes...this is deleted.

Then when I'm SELECTing data from this table I make sure my WHERE condition has:

WHERE bIsDeleted &lt;&gt; 1

Make sure you don't have NULL values in that column, otherwise your WHERE clause will need to also look for NULL and &lt;&gt; 1</description>
		<content:encoded><![CDATA[<p>@Sohbet - Normally I&#8217;d create a column in my table called something like &#8220;bIsDeleted&#8221; (the &#8216;b&#8217; standing for boolean).</p>
<p>The datatype in MSSQL would be &#8216;bit&#8217;, but for MySQL I&#8217;d typically use &#8216;tinyint&#8217;. I would only store a &#8216;0&#8242; or &#8216;1&#8242; in this column.</p>
<p>When I want to delete that row I simply UPDATE its value to &#8216;1&#8242; meaning true, or yes&#8230;this is deleted.</p>
<p>Then when I&#8217;m SELECTing data from this table I make sure my WHERE condition has:</p>
<p>WHERE bIsDeleted <> 1</p>
<p>Make sure you don&#8217;t have NULL values in that column, otherwise your WHERE clause will need to also look for NULL and <> 1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sohbet</title>
		<link>http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-47480</link>
		<dc:creator>Sohbet</dc:creator>
		<pubDate>Sun, 27 Apr 2008 20:35:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-47480</guid>
		<description>am doing a web based project using mysql and perl ,I just want to know how to create deletion flags so that the data is
actually not deleted from the database.</description>
		<content:encoded><![CDATA[<p>am doing a web based project using mysql and perl ,I just want to know how to create deletion flags so that the data is<br />
actually not deleted from the database.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VIJAYKUMAR H.K</title>
		<link>http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-7197</link>
		<dc:creator>VIJAYKUMAR H.K</dc:creator>
		<pubDate>Tue, 24 Apr 2007 11:37:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-7197</guid>
		<description>Hi Michael,
Thanks very much for ur help</description>
		<content:encoded><![CDATA[<p>Hi Michael,<br />
Thanks very much for ur help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sharman</title>
		<link>http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-5849</link>
		<dc:creator>Michael Sharman</dc:creator>
		<pubDate>Mon, 09 Apr 2007 12:54:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-5849</guid>
		<description>Hi VIJAYKUMAR,

Often a developer might have a column in a table who's value is an indicator of that rows status, i.e. whether that row is 'deleted' or not.

For example if I had a Users table I might have a column called bIsDeleted which is a bit (or boolean) data type. The initial value of this column would be null or 0, indicating that the current record is NOT flagged as deleted and therefore is active.

If that user was to be deleted I would UPDATE the Users table setting that flag to 1 (i.e. the boolean value of 'true'). Now my application will know that the user has been 'deleted', but my data has been retained.

e.g. 
UPDATE Users
SET bIsDeleted = 1
WHERE UserId = 10

Hope that makes sense.</description>
		<content:encoded><![CDATA[<p>Hi VIJAYKUMAR,</p>
<p>Often a developer might have a column in a table who&#8217;s value is an indicator of that rows status, i.e. whether that row is &#8216;deleted&#8217; or not.</p>
<p>For example if I had a Users table I might have a column called bIsDeleted which is a bit (or boolean) data type. The initial value of this column would be null or 0, indicating that the current record is NOT flagged as deleted and therefore is active.</p>
<p>If that user was to be deleted I would UPDATE the Users table setting that flag to 1 (i.e. the boolean value of &#8216;true&#8217;). Now my application will know that the user has been &#8216;deleted&#8217;, but my data has been retained.</p>
<p>e.g.<br />
UPDATE Users<br />
SET bIsDeleted = 1<br />
WHERE UserId = 10</p>
<p>Hope that makes sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VIJAYKUMAR H.K</title>
		<link>http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-5771</link>
		<dc:creator>VIJAYKUMAR H.K</dc:creator>
		<pubDate>Sun, 08 Apr 2007 15:46:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-5771</guid>
		<description>Hi,
  I am doing a web based project using mysql and perl ,I just want to know how to create deletion flags so that the data is 
actually not deleted from the database.

Can anybody explain this using an example
Thank you</description>
		<content:encoded><![CDATA[<p>Hi,<br />
  I am doing a web based project using mysql and perl ,I just want to know how to create deletion flags so that the data is<br />
actually not deleted from the database.</p>
<p>Can anybody explain this using an example<br />
Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Casey Dougall</title>
		<link>http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-2082</link>
		<dc:creator>Casey Dougall</dc:creator>
		<pubDate>Fri, 09 Feb 2007 01:00:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-2082</guid>
		<description>I've always been a fan of hanging on to data. E-mail hardly gets deleted, I've got Billing statement going back years because I've yet to buy a shredder, and on  the DB side. I love saving data. The good kind that is. Customer Personal data I try to get rid of the moment it's entered into the form if possible.

Audit trails haven't come up ofter but I think for your average mom-and-pop outfit this is just way overkill. They deleted something on accident even though you put the delete button way on the right of the page and added a popup stating "This record is being deleted" They still click it and call you for the magic pill. 

Well i got it because everything is marked as deleted or what I've been doing more and more is IsActive = 808 or something you would normally never use. You got IsActive = 1 for normal content,  0 for InActive,  but those items in 808 stand out in the database and since I still mark last updated by on the update, there is at lease a who was last here type mark on the record.

Very little work is done to make this happen. the button for delete still goes through the same update routine so I'm actually saving myself from having to create a delete routine. If the DB get's too big, I'll delete old records then manually.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve always been a fan of hanging on to data. E-mail hardly gets deleted, I&#8217;ve got Billing statement going back years because I&#8217;ve yet to buy a shredder, and on  the DB side. I love saving data. The good kind that is. Customer Personal data I try to get rid of the moment it&#8217;s entered into the form if possible.</p>
<p>Audit trails haven&#8217;t come up ofter but I think for your average mom-and-pop outfit this is just way overkill. They deleted something on accident even though you put the delete button way on the right of the page and added a popup stating &#8220;This record is being deleted&#8221; They still click it and call you for the magic pill. </p>
<p>Well i got it because everything is marked as deleted or what I&#8217;ve been doing more and more is IsActive = 808 or something you would normally never use. You got IsActive = 1 for normal content,  0 for InActive,  but those items in 808 stand out in the database and since I still mark last updated by on the update, there is at lease a who was last here type mark on the record.</p>
<p>Very little work is done to make this happen. the button for delete still goes through the same update routine so I&#8217;m actually saving myself from having to create a delete routine. If the DB get&#8217;s too big, I&#8217;ll delete old records then manually.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sharman</title>
		<link>http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-858</link>
		<dc:creator>Michael Sharman</dc:creator>
		<pubDate>Thu, 11 Jan 2007 21:38:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-858</guid>
		<description>Hi Ben,

Agreed, I always set my relationships during database design so referential integrity is enforced. This way you obviously couldn't delete the parent record even if you wanted to, because a child exists.

Also I don't use cascading deletes.</description>
		<content:encoded><![CDATA[<p>Hi Ben,</p>
<p>Agreed, I always set my relationships during database design so referential integrity is enforced. This way you obviously couldn&#8217;t delete the parent record even if you wanted to, because a child exists.</p>
<p>Also I don&#8217;t use cascading deletes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Wigginton</title>
		<link>http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-853</link>
		<dc:creator>Christopher Wigginton</dc:creator>
		<pubDate>Thu, 11 Jan 2007 14:40:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-853</guid>
		<description>And on the legal side of things, if it's a company, there should be a data retention policy of some sort, such as clearing out records older than 2 years.   Having too much information around can be a bad thing.  A data retention policy protects the company when such records are deleted as to providing the reason for deletion.

Automated systems can be in place that automatically purge old records as well as a mechanism that can be enabled to prevent deletion of records should a discovery process occur.</description>
		<content:encoded><![CDATA[<p>And on the legal side of things, if it&#8217;s a company, there should be a data retention policy of some sort, such as clearing out records older than 2 years.   Having too much information around can be a bad thing.  A data retention policy protects the company when such records are deleted as to providing the reason for deletion.</p>
<p>Automated systems can be in place that automatically purge old records as well as a mechanism that can be enabled to prevent deletion of records should a discovery process occur.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Nadel</title>
		<link>http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-850</link>
		<dc:creator>Ben Nadel</dc:creator>
		<pubDate>Thu, 11 Jan 2007 13:17:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/2007/01/11/to-delete-or-not-to-delete/#comment-850</guid>
		<description>Other than storing "deleted' information for history and review purposes, I find that it is good for "referential integrity". Like, if you store the user ID of the user that created some object and then later on that user gets deleted... now you have an ID in a record that does not have a user to which it is referring. However, if you only flag as deleted than you pretty much never have to worry about how to handle referential integrity.</description>
		<content:encoded><![CDATA[<p>Other than storing &#8220;deleted&#8217; information for history and review purposes, I find that it is good for &#8220;referential integrity&#8221;. Like, if you store the user ID of the user that created some object and then later on that user gets deleted&#8230; now you have an ID in a record that does not have a user to which it is referring. However, if you only flag as deleted than you pretty much never have to worry about how to handle referential integrity.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
