sasdevelopment
asked on
How do I insert multiple rows into a single table with one INSERT statement?
Really dumb question, but I'm totally confused. I want to insert multiple rows into a table with one statement. The obvious approach (well, at least I thought it was) is to execute the command...
INSERT INTO [MyDatabase].[dbo].[MenuAc tions] ([Menu_ID],[Name],[Sequenc e],[Action _Type],[Ac tion],[Tar get],[IsDe fault],[Ta rget_Group ])
VALUES
('ec404cee-6cfc-4279-a396- c7cb271f13 09', 'Submit',100, 'JavaScript', 'submit()','_blank',1,'vie wers'),
('ec404cee-6cfc-4279-a396- c7cb271f13 09', 'Cancel',200, 'JavaScript', 'cancel()','_blank',1,'vie wers'),
('ec404cee-6cfc-4279-a396- c7cb271f13 09', 'Help',300, 'JavaScript', 'help()','_blank',1,'viewe rs')
GO
Well, SQL Server chokes on the ',' after the first entry.
Is it possible to do this? If so, how does it need to be formatted?
INSERT INTO [MyDatabase].[dbo].[MenuAc
VALUES
('ec404cee-6cfc-4279-a396-
('ec404cee-6cfc-4279-a396-
('ec404cee-6cfc-4279-a396-
GO
Well, SQL Server chokes on the ',' after the first entry.
Is it possible to do this? If so, how does it need to be formatted?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if you notice, nobody else has commented because aneesh has supplied the right answer... please award the points to him so other experts do not spend time reviewing. thanks!
ASKER
Thanks Aneesh and Aaron.