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

x
?
Solved

Multiple rows insert using Stored Procedure

Posted on 2009-07-06
5
Medium Priority
?
717 Views
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.
0
Comment
Question by:redflair
  • 3
5 Comments
 
LVL 4

Expert Comment

by:j_s_kelley
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.
0
 
LVL 75

Expert Comment

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

Author Comment

by:redflair
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?
No

Is the data in a file?
No

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

Author Comment

by:redflair
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..
0
 
LVL 3

Accepted Solution

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

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

886 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