SPR_SequenceCustom - Returning the next Capita sequence to use for insert statements where tables have custom sequences

For sharing any stored procedures
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
robinwilson16
Site Admin
Posts: 185
Joined: Sun Oct 16, 2016 6:46 pm
Forename: Robin
Surname: Wilson
College Name: FEA
Position: MIS Consultant
LinkedIn Profile: https://www.linkedin.com/in/robinwilson16
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

SPR_SequenceCustom - Returning the next Capita sequence to use for insert statements where tables have custom sequences

Post by robinwilson16 » Mon Feb 20, 2017 6:17 pm

Procedure to set and retrieve the next sequence value (not yet used this one!):

Code: Select all

ALTER PROCEDURE [dbo].[SPR_SequenceCustom]
	@reference AS VARCHAR(50)
AS
BEGIN
	DECLARE @Seq AS VARCHAR(50) = '0'

	UPDATE caps_sequences WITH (TABLOCK) 
	SET
		seq_value = seq_value + 1  
	WHERE
		seq_ref = @reference;
	
	SELECT 
		S.seq_id,
		S.seq_format,
		S.seq_value 
	FROM caps_sequences S
	WHERE 
		seq_ref = @reference

	-- TO DO: Need to return the new sequence in the correct format
END
So far I have not found a use for this sequence. You probably just need the standard sequence generator here: viewtopic.php?f=23&t=100

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 0 guests