Solved

Multiple rows insert using Stored Procedure

Posted on 2009-07-06
5
707 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Syntax Error 2 45
triggered use of sp_send_dbmail failure 2 22
Code works but it's slow 24 40
Ssis not sending failure message 2 9
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now