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

Pushing inserts into SQL server with C# ? Expand / Collapse
Author
Message
Posted Tuesday, November 19, 2013 3:27 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, May 15, 2014 8:51 PM
Points: 183, Visits: 480
I want to insert about 5000 (typically, can be 10K+ at times) rows into SQL server at a time. My insert statements are generated by a C# program.

One way could be by simply generating a big string full of these SQL statements and then actually making SQL server execute them using `SqlCommand.ExecuteNonQuery();` But there is a risk that SQL server might not be able to execute a big statement like that.

Is there a way I could sort of push the SQL statements to some kind of "SQL server buffer" (if there is one) and then finally execute them all ?

Thanks.
Post #1515818
Posted Wednesday, November 20, 2013 7:40 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:13 PM
Points: 13,085, Visits: 12,551
Duplicate post. Direct replies here. http://www.sqlservercentral.com/Forums/Topic1515817-391-1.aspx

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1516067
Posted Thursday, November 21, 2013 11:19 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, May 15, 2014 8:51 PM
Points: 183, Visits: 480
Sean Lange (11/20/2013)
Duplicate post. Direct replies here. http://www.sqlservercentral.com/Forums/Topic1515817-391-1.aspx


Had no choice. Will miss out on the folks that hang out only on this sub forum. This site and msdn...actually everything should move to Stack overflow which is far more convenient. There is no confusion, only simplicity and solutions. How about an ETL job for that movement ? :)
Post #1516532
Posted Thursday, November 21, 2013 11:52 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:13 PM
Points: 13,085, Visits: 12,551
blasto_max (11/21/2013)
This site and msdn...actually everything should move to Stack overflow which is far more convenient. There is no confusion, only simplicity and solutions. How about an ETL job for that movement ? :)


Don't think you will find a lot of people around here agreeing that SO is better. There is less than a 0% chance that MSDN is going to migrate to SO. SO is for questions and MSDN (or technet) is for system documentation, but it happens to allow comments.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1516537
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse