I'd like to be able to insert some values into a table using a single INSERT statement, but I'm having trouble determining the best way. The data I'm inserting is bootstrap (or hard-coded) data, ie. not available in another table. Here's what I've tried so far.
create table #t (id int)
insert into #t values (1) --- (a)
insert into #t values (5) --- (a)
insert into #t values ((5), (3), (22)) --- (b)
insert into #t --- (c)
select 3 union all
select 5 union all
select 6 union all
select 8
The code at (a) works just fine, but adds only a single value per insert.
The code at (b) seems to be the logical extension of (a) to me (at least when I think of initialisers from Perl or Java), but doesn't work.
The code at (c) works and is probably more of the SQL way, but seems verbose.
Is there a variant of (b) that works? Or is there an approach like (c) that requires less typing?
I'm using SQL Server 2000, but I'm interested in something that's fairly portable if possible.
UPDATE: Thanks to everynoe who answered. In summary, it seems the SQL standard has a multi-insert, which is what I was after, but is not supported in my environment. So I will stick with (a) for simplicity and clarity.