Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Multiple rows insert using Stored Procedure

Posted on 2009-07-06
Medium Priority
Last Modified: 2012-05-07
Hello Experts,

I use ASP.net as the front-end and MS SQL 2008 as Database Server. I am a newbie, have been trying to write a stored procedure which should take list of rows as input and do bulk insert, all at once (no multiple INSERT INTO).

I read up on Bulk Insert, but that takes data from flat files which cannot help my case.

Is there a better way to do this? Appreciate any help!

Thank you.
Question by:redflair
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
  • 3

Expert Comment

ID: 24785659
What is the source of the data.  When you say a "list of rows", what does that mean?  Is it a a list of rows from a database table?  Is the data in a file?  Has the data been input into a DataGridView?  The answer will help determine the best solution.
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24785936
you can pass the list of data as an xml

Author Comment

ID: 24786187
When you say a "list of rows", what does that mean?
Similar to Bulk Insert, I got to insert multiple rows at once.

Is it a a list of rows from a database table?

Is the data in a file?

Has the data been input into a DataGridView?  
Yes, user would enter values in DataGridView.

Author Comment

ID: 24786478
"you can pass the list of data as an xml "

Thank you, I can either use XML or CSV values as input for SP. But I would like to know how to do insert all records at once..

Accepted Solution

redflair earned 0 total points
ID: 24846872
I could use Insert Into Values (set-1), (set-2).

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

718 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