>>>Is there any equivalent function (GETAUTOINCVALUE) to get the autoinc value in MS SQL SERVER ?
>>
>>Yes, SCOPE_IDENTITY() function.
>>
>>In SQL Server 2005 and up the best method would be to use OUTPUT clause of the INSERT command to get the new ID.
>Thanks Naomi. Can you please give me an example how to pass the OUTPUT cause?
declare @Output table (ID int)
insert into myTable (field1, field2) OUTPUT Inserted.Id INTO @Output values (@Param1, @Param2)
select * from @Output
or the same without a table variable.
See
http://technet.microsoft.com/en-us/library/ms177564.aspx
If it's not broken, fix it until it is.
My Blog