Maxxamillian
MIS
Just need to be able to print out the value in next_value column but cant get it to go!
CREATE PROC spUpdFsrHeaderID
AS
--Declare parameters. Names = column headers
DECLARE @StartValue int
DECLARE @EndValue int
DECLARE @NextValue int
DECLARE @ValueWidth int
--declare new varriable new_next_value as an int as it will equal the next_value varriable plus
--1 plus the value_width varriable.
DECLARE @NewNextValue int
--set parameters to equal information already contained within the db
SELECT @StartValue = start_value, @EndValue = end_value,
@NextValue = next_value, @ValueWidth = value_width
FROM table_num_scheme
WHERE Name = 'FSR Header ID'
--Set NewNextValue to equal the NextValue + 1 + ValueWidth. This is the updated value
--in the next_value column.
SELECT @NewNextValue = @NextValue + 1 + @ValueWidth
--declare new varriable new_next_value as an int that will equal the next_value varriable plus
--1 plus the value_width varriable.
--make sure that new value is not greater than the end value (20000)
--and if it is reset the start_value column to "1"
IF @NewNextValue > @EndValue
UPDATE table_num_scheme
SET next_value = @StartValue
WHERE Name = 'FSE Header ID'
ELSE
PRINT @NextValue
CREATE PROC spUpdFsrHeaderID
AS
--Declare parameters. Names = column headers
DECLARE @StartValue int
DECLARE @EndValue int
DECLARE @NextValue int
DECLARE @ValueWidth int
--declare new varriable new_next_value as an int as it will equal the next_value varriable plus
--1 plus the value_width varriable.
DECLARE @NewNextValue int
--set parameters to equal information already contained within the db
SELECT @StartValue = start_value, @EndValue = end_value,
@NextValue = next_value, @ValueWidth = value_width
FROM table_num_scheme
WHERE Name = 'FSR Header ID'
--Set NewNextValue to equal the NextValue + 1 + ValueWidth. This is the updated value
--in the next_value column.
SELECT @NewNextValue = @NextValue + 1 + @ValueWidth
--declare new varriable new_next_value as an int that will equal the next_value varriable plus
--1 plus the value_width varriable.
--make sure that new value is not greater than the end value (20000)
--and if it is reset the start_value column to "1"
IF @NewNextValue > @EndValue
UPDATE table_num_scheme
SET next_value = @StartValue
WHERE Name = 'FSE Header ID'
ELSE
PRINT @NextValue