You can insert multiple records in one INSERT command probably in all versions of SQL Server, but you can use OUTPUT clause starting from SQL Server 2005 and up.
UPDATE. I see your point - you meant multiple values in one command - this is only SQL Server 2008 feature, you're right.
>>Is there any equivalent function (GETAUTOINCVALUE) to get the autoinc value in MS SQL SERVER ?
>
>Hi Yiorgos,
>How are you doing. I would prefer "OUTPUT" clause because in SQL2008 you can insert multiple rows in one go but functions like scope_identity() return a single scalar value. Here is a sample:
>
>
>lnHandle = Sqlstringconnect("Driver={SQL Server Native Client 10.0};Server=.\sql2008;Trusted_Connection=yes;Database=test")
>TEXT TO lcSQL noshow
>CREATE TABLE MyIdTest (
> id INTEGER IDENTITY PRIMARY KEY,
> dummy VARCHAR(100))
>ENDTEXT
>
>SQLExec(m.lnHandle, m.lcSQL)
>
>TEXT TO lcInsertMulti noshow
>DECLARE @MyTable table( id INTEGER, myvalue varchar(10) );
>
>INSERT MyIdTest (dummy)
> OUTPUT INSERTED.id, INSERTED.dummy INTO @myTable
> VALUES ('AA'),('BB'),('CC')
>
>SELECT * FROM @myTable
>ENDTEXT
>
>SQLExec(m.lnHandle, m.lcInsertMulti, 'result')
>SQLDisconnect(m.lnHandle)
>Select result
>Browse
Cetin
If it's not broken, fix it until it is.
My Blog