_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › MS-SQLOracleSequence磯狩蠍

Contents

1
2


1 #

豈覯 蠏狩 螻豺 譯殊願鹸 讌襷.. 伎覲企 螳.

2 #

use tempdb
go

--豐蠍一誤
create table dbo.Sequence(seq int)
insert dbo.Sequence values(1)
go

create proc dbo.usp_Sequence
	@option tinyint --1:currval, 2:nextval, 
,	@increment int = 1
as
declare @seq int;

if @option = 2
begin
	update dbo.Sequence
	set @seq = seq = seq + @increment;
end else
	set @seq = (select top 1 seq from dbo.Sequence);

return @seq;
go

--: 螳
declare @seq int
exec @seq = dbo.usp_Sequence 1
select @seq

--: れ螳
declare @seq int
exec @seq = dbo.usp_Sequence 2
select @seq
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:52

企ゼ れ蟆 觜蟲讌 蠍 (れ)