2012-09-11 14 views

उत्तर

35
INSERT INTO example 
VALUES 
    (100, 'Name 1', 'Value 1', 'Other 1'), 
    (101, 'Name 2', 'Value 2', 'Other 2'), 
    (102, 'Name 3', 'Value 3', 'Other 3'), 
    (103, 'Name 4', 'Value 4', 'Other 4'); 
+0

यह MySQL वाक्य रचना, यकीन नहीं है अगर यह सामान्य एसक्यूएल में स्वीकार किया जाता है। कुछ डीबीएमएस शायद इस वाक्यविन्यास का समर्थन नहीं कर सकते हैं। – Konerak

+5

एसक्यूएल सर्वर भी इस वाक्यविन्यास का समर्थन करता है। – fancyPants

+1

@ कोनेरक [यह SQLFiddle देखें] (http://sqlfiddle.com/#!3/d314c/5) – hims056

2

उपयोग कर सकते हैं आप किसी तालिका में एकाधिक डालने प्रदर्शन करने के लिए UNION All खंड का उपयोग कर सकते हैं।

पूर्व:

INSERT INTO dbo.MyTable (ID, Name) 
SELECT 123, 'Timmy' 
UNION ALL 
SELECT 124, 'Jonny' 
UNION ALL 
SELECT 125, 'Sally' 

Check here

4
1--> {Simple Insertion when table column sequence is known} 
    Insert into Table1 
    values(1,2,...) 

2--> {Simple insertion mention column} 
    Insert into Table1(col2,col4) 
    values(1,2) 

3--> {bulk insertion when num of selected collumns of a table(#table2) are equal to Insertion table(Table1) } 
    Insert into Table1 {Column sequence} 
    Select * -- column sequence should be same. 
     from #table2 

4--> {bulk insertion when you want to insert only into desired column of a table(table1)} 
    Insert into Table1 (Column1,Column2 ....Desired Column from Table1) 
    Select Column1,Column2..desired column from #table2 
3

आप और अधिक संदर्भ जाँच के लिए वक्तव्य

BULK INSERT TableName 
FROM 'filePath' 
WITH 
(
    FIELDTERMINATOR = '','', 
    ROWTERMINATOR = ''\n'', 
    ROWS_PER_BATCH = 10000, 
    FIRSTROW = 2, 
    TABLOCK 
) 

एसक्यूएल बल्क सम्मिलित उपयोग कर सकते हैं

https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=sql%20bulk%20insert

आप बल्क आपका डाटा कोड के साथ-साथ

कि के लिए सम्मिलित कर सकते हैं कृपया लिंक नीचे की जाँच करें:

http://www.codeproject.com/Articles/439843/Handling-BULK-Data-insert-from-CSV-to-SQL-Server

संबंधित मुद्दे