Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Most Efficient way to insert data to SQL Server table

Posted on 2015-02-20
1
Medium Priority
?
205 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 2000 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Ready to get certified? Check out some courses that help you prepare for third-party exams.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

782 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