Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Techniques for Deleting Complex Records Set using Sql Server 2008

Author: Zunnair

This article Explain you 2 techniques for deletion of complex record set. And one of them is recommended.

This article explains the way in which we can delete records from one table on the basis of second table. We have two valid options to do that query.

1-       We can use Select command with one table and then select in from other.

2-       We can use inner join technique.

 

The Following query Explain the first option. And this will always Slower then Second one and also not recommended.

 

 

Delete From tblA

            Where A.ColID in (Select ColID From tblB

                                    Where not ColID is null)

The Following query Explain the Second option. And this will always Faster then First one and also this Option is recomended.

Delete A from tblA A

              Inner join tblB B 

              on A.ColID = B.ColID

So I Hope this technique will help you while you have to delete complex Record Set.

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Import Data from Note Pad Files to Sql Server 2008 using PL-Sql.

Disclaimer - Privacy
© 2002-2017 DevASP.net