Hi All,
How to insert 10rows of data at a time with 1 query into a table?
Hi All,
How to insert 10rows of data at a time with 1 query into a table?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Jun 29, 2008, 9:25 PM EDT
Try this:
INSERT INTO thetable (field1, field2)
SELECT value1, value2
UNION ALL
SELECT value3, value4
UNION ALL
.
.
.
SELECT value5, value6;
Ali Zaidi90 reputationPosted Jun 29, 2008, 9:29 PM EDT
ravindar pailla65 reputationPosted Jun 29, 2008, 9:34 PM EDT
yes,
and can we write with one single query?
Ali Zaidi90 reputationPosted Jun 29, 2008, 9:40 PM EDT
yes
first write xml for your grid rows
ex:value value |
Now in sql server we have a procedure that converts xml to a table
XMLPreParedocument @XMLString,@Doc
OPENXML()
you can see this in sqlserver functions
Vijaya KadiyalaRank #1,085 · 1.8K reputationPosted Jun 30, 2008, 10:07 AM EDT
Hi,
You have to write 10 different Insert statements if you have explicit values.
Thanks -- Vj
http://dotnetvj.blogspot.com