Details
Asked in Category :: Computers & Internet Software
Insert Multiple Values in SQL Table

How to insert multiple values in table using only one insert?

Best Answer
X
Best Answer - Chosen by Asker
Usually what we do is USE Your_DB GO INSERT INTO DummyTable (Col_1, Col_2) VALUES ('First',1); INSERT INTO DummyTable (Col_1, Col_2) VALUES ('Second',2); INSERT INTO DummyTable (Col_1, Col_2) VALUES ('Third',3); GO Above the clause INSERT INTO is repeated many times. Another way is to use UNION ALL and INSERT INTO … SELECT… clauses. USE Your_DB GO INSERT INTO DummyTable (Col_1, Col_2) SELECT 'First' ,1 UNION ALL SELECT 'Second' ,2 UNION ALL SELECT 'Third' ,3 GO
Posted by merilturock on 20.08.2017 (20.08.2017)
0% 0 Votes
Rate this:

 

Other Answers
No other Answers posted.
Active Questions in this Category
No open Questions in this Category
Comments
Order by: 
Per page:
 
  • There are no comments yet