Solved

Most Efficient way to insert data to SQL Server table

Posted on 2015-02-20
1
160 Views
Last Modified: 2015-02-20
I have a .net console app
Currently, I'm inserting into 1 table and using a trigger on that one table to insert into another
....a long story short, Its causing me a debug headache, so i'm looking to insert into both tables directly from the Console app

Back in the olden days, the most efficient way was to write a stored procedure and insert this way, however, i'm not sure this the case any more????
Can i simply write a "insert into blah" directly in .net code and it be just as quick?
I'm handling potentially hundreds of inserts every second/few seconds, so it needs to be ultra quick and efficient

I've never used LINQ, but it its going to be a massive performance increase then i will learn it
if anyone can shed any light on this it would be helpful
.net 4.5 and sql server 2014
0
Comment
Question by:websss
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 40620665
>Back in the olden days, the most efficient way was to write a stored procedure and insert this way,
still the best way

>Can i simply write a "insert into blah" directly in .net code and it be just as quick?
it will not have the same speed, as the sql entine has then for "each call", check the sql (compile, check permissions etc)
with a stored procedure, the code is pre-compiled etc, and a single procedure call will also reduce the network traffic as only the small data has to go over the network and not the full sql...


LINQ will just add another layer to the code, and should be avoided in my opinion
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how the fundamental information of how to create a table.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question