• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

TSQL question - INSERTing multiple rows simultaneously

NuclearNed

Raconteur
I think this can be done, but I'm drawing blanks on the exact syntax...

I want to do something like this:

INSERT table
VALUES
(
(1, 'record1'),
(2, 'record2'),
(3, 'record3')
)

At least it seems like I've done this before... where am I going wrong?
 
I think you want to eliminate the outer '(' ')' pair after values. Just "VALUES (a,b), (c,d), (e,f)"

Edit: Taken from this Wiki page. It does mention this won't work on SQL Server, have to do a funky SELECT/UNION ALL construct.
 
Originally posted by: Cerebus451
I think you want to eliminate the outer '(' ')' pair after values. Just "VALUES (a,b), (c,d), (e,f)"

Edit: Taken from this Wiki page. It does mention this won't work on SQL Server, have to do a funky SELECT/UNION ALL construct.

Thanks!
 
Back
Top