Solved

Most Efficient way to insert data to SQL Server table

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

772 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