sql返回行id
1、sql语句中
insert into tableName() output inserted.id values()
2 、存储过程中
ALTER PROCEDURE dbo.getBuyMedicID
(
@id int output,
@AllsumMoney money
)
AS
begin
INSERT INTO
t_buyMedic(sumMoney,buyDate)
VALUES(@AllsumMoney,getdate())
select @id=@@identity
end
RETURN