Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax to insert more than one row in table

Status
Not open for further replies.

ashark

Programmer
Nov 21, 2002
31
0
0
IN
Hi Group,
I wnat to insert more than one row in table.
Can you please tell me how that can be done in one SQL statement

Thankyou.
ashark
 
Hi swampBoogie,
Do you want to say that :
INSERT INTO Table (PriKey, Description)
VALUES (123, 'A description of part 123.')
union
VALUES (124, 'A description of part 124.')

 
can you please explain me how you insert multiple rows in a single SQL statement.
 
Hi,

What swampboogie has suggested should work. If that is not wht u want, please give an example of wht u r trying to accomplish.

Sunil
 
Try:

INSERT INTO Table (PriKey, Description)
Select 123, 'A description of part 123.'
union
Select 124, 'A description of part 124.'

Of course if your PriKey is an identity field you wouldn;t put it in the insert! Then try:

INSERT INTO Table (Description)
Select 'A description of part 123.'
union
Select 'A description of part 124.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top