Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to processing 1000000 records

Author  Topic 

ARC_kly
Starting Member

1 Post

Posted - 2012-02-06 : 08:03:59
Hi all,
Please suggest me what will be best way to processing 1000000 records in following logic..

Begin Loop on Master Table
Posting on Transaction File
Begin Loop on Detail Table
Posting on Transaction File
Loop
Loop
---------------------------------------------------
Posting Procedure on Transaction File
If record not exits in Transaction File
Begin
Insert New Record
End
Else
Begin
Update Same records
End

- Regrds
A Roy Chowdhury

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-02-06 : 08:06:57
More likely than not, the most efficient way to do this would be to do a set-based query that updates all the records, perhaps in a transaction, with appropriate exception handling etc.

If you post the table DDL, some sample output data and expected results, there are several people on this forum who would be able to advise you with more specifics. Take a look at Brett's blog here for some guidance on how to post all of that info: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -