CREATETABLEdbo.GlobalSequence
(
idINTIDENTITY(1, 1)
)
GO
CREATEPROCseq(@id INTOUTPUT)
AS
BEGIN
BEGINTRAN
DECLARE@NewSequenceValueTABLE (ID INT);
INSERTINTOdbo.GlobalSequence
OUTPUTinserted.id
INTO@NewSequenceValue
DEFAULTVALUES
ROLLBACKTRAN
SELECT@id=id
FROM@NewSequenceValue
END
-- test
DECLARE@idINT
EXECseq@id OUTPUT
SELECT@id
新闻热点
疑难解答