June 4, 2012

sp_MSsub_set_identity (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_MSsub_set_identity(int @objid
, int @threshold
, bigint @range
, bigint @next_seed)

MetaData:

 create procedure sys.sp_MSsub_set_identity  
@objid int,
@threshold int,
@range bigint,
@next_seed bigint
as
declare @retcode int

-- Security Check
EXEC @retcode = sys.sp_MSreplcheck_subscribe
IF @@ERROR <> 0 or @retcode <> 0
RETURN(1)

-- Stored last_seed in @next_seed
select @next_seed = @next_seed - @range

update MSsub_identity_range set
last_seed = @next_seed,
threshold = @threshold,
range = @range
where objid = @objid
IF @@ERROR <> 0
return 1
-- RESEED and change constraint
exec @retcode = sys.sp_MSreseed
@objid = @objid,
@next_seed = @next_seed,
@range = @range,
@is_publisher = -1
IF @@ERROR <> 0 OR @retcode <> 0
return 1

No comments:

Post a Comment

Total Pageviews