<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[My Visual Database — Delete (clear) Multiple Tables that are Connected with other Tables]]></title>
		<link>https://myvisualdatabase.com/forum/viewtopic.php?id=7507</link>
		<atom:link href="https://myvisualdatabase.com/forum/extern.php?action=feed&amp;tid=7507&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Delete (clear) Multiple Tables that are Connected with other Tables.]]></description>
		<lastBuildDate>Sat, 01 May 2021 10:00:32 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Delete (clear) Multiple Tables that are Connected with other Tables]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=40863#p40863</link>
			<description><![CDATA[<p>Thanks, Derek, that was it.</p><p>So now I am going in the schema and looking at the linked tables and slowly scripting a cascading delete of each table before the last delete, which is the central database of clients.</p><p>I appreciate the help all give on the forum. Thanks.</p>]]></description>
			<author><![CDATA[null@example.com (jeffmtl@hotmail.com)]]></author>
			<pubDate>Sat, 01 May 2021 10:00:32 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=40863#p40863</guid>
		</item>
		<item>
			<title><![CDATA[Re: Delete (clear) Multiple Tables that are Connected with other Tables]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=40858#p40858</link>
			<description><![CDATA[<p>Hi Jeff,<br />You&#039;re on the right lines.<br />You can&#039;t delete entries from a table if those entries are referenced in a related table (it would create &#039;orphan records&#039;);&nbsp; it&#039;s what&#039;s known as &#039;referential integrity&#039;.<br />So you need to delete the tables you want to clear in sequence, starting with the tables that have a relational dependency..<br />Have a look at the example - table2 is related to table1 and so must be deleted first (try it the other way around and you&#039;ll get the same error message you&#039;ve been encountering).<br />(there is a copy of sqlite.db (sqlite2.db) in the attachment - it just saves you having to recreate test data when you&#039;re trying out the program).<br />Hope this helps,<br />Derek.</p>]]></description>
			<author><![CDATA[null@example.com (derek)]]></author>
			<pubDate>Fri, 30 Apr 2021 11:09:05 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=40858#p40858</guid>
		</item>
		<item>
			<title><![CDATA[Delete (clear) Multiple Tables that are Connected with other Tables]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=40857#p40857</link>
			<description><![CDATA[<p>Hi All, hope you guys can help or lead me to the right direction.</p><p>Now that I&#039;ve built an application, I would like to share it with people at work. With one click at a hidden button, I could the necessary tables and clear the tables.&nbsp; I&#039;ve tried this code as a test in a testing environment.</p><br /><br /><p><strong>procedure fmMainMenu_Button7_OnClick (Sender: TObject; var Cancel: boolean);<br />&nbsp; &nbsp; &nbsp;begin<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SQLExecute(&#039;DELETE FROM dtTimeTableListing&#039;);<br />&nbsp; &nbsp; &nbsp;end;</strong></p><br /><p>Yet I get the following message:</p><p><em>Error Message<br />FFOREIGN KEY constraint failed</em></p><p><em>Script: SQLExecute.<br /></em></p><p>I am assuming the cause is links between other tables ? !</p><p>I&#039;ve done as much research as my &quot;PROGRAMMER WANT-TO-BE&quot; brain can handle and would need simple coding to clear tables I think i need to before it becomes too spaghetti programming for my mind.</p><p>Also, am I on the right track to think, that one needs clear the links of secondary tables that feed to a main table ? (Does my sentence may any sense ?)</p><p>Thanks for your help everybody.</p>]]></description>
			<author><![CDATA[null@example.com (jeffmtl@hotmail.com)]]></author>
			<pubDate>Fri, 30 Apr 2021 09:49:32 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=40857#p40857</guid>
		</item>
	</channel>
</rss>
