﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / Deleting the records without foreign key / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 19 May 2013 23:42:54 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Deleting the records without foreign key</title><link>http://www.sqlservercentral.com/Forums/Topic1374421-392-1.aspx</link><description>[quote][b]raghuveer126 (10/22/2012)[/b][hr]I did inner join put a where clause and deleted one table there were x rows affected but when i try to put one more table from the inner joins i used in the delete statement it is not deleting the related records in that table, it says 0 rows affected.If it has no foreign keys than how do i know which table to delete first...[/quote] first you should verify the data by select it before deleting it. another thing one query will delete the data from one table at a time (i havent seen anything link Delete table1, table2 from .............) then  another query for second deletion</description><pubDate>Tue, 23 Oct 2012 04:35:02 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>RE: Deleting the records without foreign key</title><link>http://www.sqlservercentral.com/Forums/Topic1374421-392-1.aspx</link><description>[quote][b]EamonSQL (10/19/2012)[/b][hr]Create a trigger that seeks out any child records and deletes them if found.Eamon:-)[/quote] i didnt see any comment from OP that he wants to delete data with every DML operation .its by choice or i would say manual call</description><pubDate>Tue, 23 Oct 2012 04:31:13 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>RE: Deleting the records without foreign key</title><link>http://www.sqlservercentral.com/Forums/Topic1374421-392-1.aspx</link><description>I would be very nervous about deleting records from a DW as the nature of them can mean that while its ok to delete from dimensions based on one set of requirements, you could actually be deleting valid records that are required by other Facts that dont meet those requirements. Can you explain why you need to delete these records and what type of DW it is? (eg Star Schema, Snowflake, Incremental/Snapshot load)</description><pubDate>Tue, 23 Oct 2012 00:45:44 GMT</pubDate><dc:creator>Jason-299789</dc:creator></item><item><title>RE: Deleting the records without foreign key</title><link>http://www.sqlservercentral.com/Forums/Topic1374421-392-1.aspx</link><description>Hi Thank you for the reply.. I did inner join put a where clause and deleted one table there were x rows affected but when i try to put one more table from the inner joins i used in the delete statement it is not deleting the related records in that table, it says 0 rows affected.If it has no foreign keys than how do i know which table to delete first...</description><pubDate>Mon, 22 Oct 2012 17:14:13 GMT</pubDate><dc:creator>sql_reporting</dc:creator></item><item><title>RE: Deleting the records without foreign key</title><link>http://www.sqlservercentral.com/Forums/Topic1374421-392-1.aspx</link><description>Create a trigger that seeks out any child records and deletes them if found.Eamon:-)</description><pubDate>Fri, 19 Oct 2012 05:28:20 GMT</pubDate><dc:creator>EamonSQL</dc:creator></item><item><title>RE: Deleting the records without foreign key</title><link>http://www.sqlservercentral.com/Forums/Topic1374421-392-1.aspx</link><description>[quote][b]raghuveer126 (10/18/2012)[/b][hr]i have datawarehouse database where there is only primary key and no foreign keys.I have a condition from one table and based on that condition i have to delete the records from other tables.I am trying to use joins and delete the records based on that condition. Is this right way or else anyother way to delete.[/quote]1. It might be the right way.2. There is a possibility that there are other ways exist which you can use to delete.That about the best answer I can think of, based on details you have provided.</description><pubDate>Thu, 18 Oct 2012 09:35:23 GMT</pubDate><dc:creator>Eugene Elutin</dc:creator></item><item><title>Deleting the records without foreign key</title><link>http://www.sqlservercentral.com/Forums/Topic1374421-392-1.aspx</link><description>i have datawarehouse database where there is only primary key and no foreign keys.I have a condition from one table and based on that condition i have to delete the records from other tables.I am trying to use joins and delete the records based on that condition. Is this right way or else anyother way to delete.</description><pubDate>Thu, 18 Oct 2012 08:55:53 GMT</pubDate><dc:creator>sql_reporting</dc:creator></item></channel></rss>