Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 insert value

Author  Topic 

avijit_mca
Posting Yak Master

109 Posts

Posted - 2009-12-04 : 09:15:34
i have datagrid.
enter 10 rows in datagrid.
iwant write sp to insert these 10 rows at a single transcation.

how i will do it..

Regards,
Avijit

Regards,
avijit

sql-programmers
Posting Yak Master

190 Posts

Posted - 2009-12-21 : 11:05:42
You can build a query string something like this and insert multiple rows.

GO
INSERT INTO MyTable (Col1, Col2, Col3)
SELECT 'Value1' ,'Value2', 'Value3'
UNION ALL
SELECT 'Value11' ,'Value12', 'Value13'
UNION ALL
SELECT 'Value21' ,'Value22', 'Value23'

SQL Server Programmers and Consultants
http://www.sql-programmers.com/
Go to Top of Page

wayne.zjw
Starting Member

10 Posts

Posted - 2009-12-23 : 16:02:56
really good solution
i'm looking for it


quote:
Originally posted by sql-programmers

You can build a query string something like this and insert multiple rows.

GO
INSERT INTO MyTable (Col1, Col2, Col3)
SELECT 'Value1' ,'Value2', 'Value3'
UNION ALL
SELECT 'Value11' ,'Value12', 'Value13'
UNION ALL
SELECT 'Value21' ,'Value22', 'Value23'

SQL Server Programmers and Consultants
http://www.sql-programmers.com/



RAQ Report - the best free java reporting tool ever
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-23 : 16:22:45
I have locked wayne's account since he provides no relevant information and justs posts to spam his link. I will be removing the spam shortly.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -