Solved

Most Efficient way to insert data to SQL Server table

Posted on 2015-02-20
1
149 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 142

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now