Files
time-cafe-desktop-app/sqlscripts/procedures/specific-procedures/unused/procedure-get_next_barcode.sql
T

23 lines
546 B
Transact-SQL
Raw Normal View History

2026-07-12 13:56:05 +04:00
USE [Database]
IF OBJECT_ID('[Procedures].[get_next_barcode]', 'P') IS NOT NULL
DROP PROCEDURE [Procedures].[get_next_barcode];
GO
CREATE PROCEDURE [Procedures].[get_next_barcode]
@next_barcode AS BIGINT OUTPUT
AS
BEGIN TRANSACTION;
SET NOCOUNT ON;
SET @next_barcode = (
SELECT CAST([value] AS BIGINT) + 1
FROM [Tables].[additional_variables]
WHERE [id] = 1
);
UPDATE [Tables].[additional_variables]
SET [value] = CAST(@next_barcode AS NVARCHAR(13))
WHERE [id] = 1;
COMMIT TRANSACTION;
GO