Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Executing Insert statements in a batch / group Expand / Collapse
Author
Message
Posted Monday, December 10, 2012 12:44 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, March 20, 2013 5:33 AM
Points: 44, Visits: 62
Dear All,

Hi! I need to generate Insert scripts of more than 1 million records & execute the same on another server. The normal frequency is weekly but, but sometimes I have to run it twice / thrice in a week.

I need to know that how we do make batch of these insert statements so that instead of executing individual statements we can execute group of Insert statements. The batch/group can be of 2000 rows or 5000 rows to improve the performance.

I also need to know that will it increase the performance as we are inserting multiple records in a single batch?
Post #1394757
Posted Tuesday, December 11, 2012 2:28 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, May 22, 2013 4:49 AM
Points: 1,075, Visits: 5,119
You can try BCP. It has options to inset rows in batches.

BCP is known to be faster than other methods.

Post #1394957
Posted Tuesday, December 11, 2012 2:20 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Saturday, April 06, 2013 9:18 AM
Points: 57, Visits: 76
I would suggest to create and run the ssis package for loading the data to another server.If that is the requirement.
Post #1395322
Posted Tuesday, December 11, 2012 2:41 PM


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, May 16, 2013 9:31 AM
Points: 65, Visits: 443
Last I knew BCP is incompatible with FULL RECOVERY MODE and I don't fly without a parachute.

We got a huge performance increase by sending a large "multi-row" XML string into a stored procedure, parsing it into a table variable and inserting the rows in one shot. It is messy but fast and you get to keep your reliable backups.
Post #1395330
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse