Solved

Most Efficient way to insert data to SQL Server table

Posted on 2015-02-20
1
172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Report 8 27
sql server query 9 27
SQL query joining 6 tables in asp.net 4 33
Importing from CSV to SSMS 2 15
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

752 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