Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This is very involved! T-SQL

Status
Not open for further replies.
Jul 25, 2000
33
0
0
US
I have started to create the following SPROC:

CREATE PROC spUpdFsrHeaderID

AS

--Declare parameters. Names = column headers

DECLARE @start_value int
DECLARE @end_value int
DECLARE @next_value int
DECLARE @value_width int

--set parameters to equal information already contained within the db


SELECT @start_value =
SELECT @end_value =
SELECT @next_value =
DECLARE @value_width =




--declare new varriable new_next_value as an int that will equal the next_value varriable plus
--1 plus the value_width varriable.

DECLARE @new_next_value int = @next_value + 1 + @value_width

--make sure that new value is not greater than the end value (20000)
--and if it is reset the start_value column to default

IF @new_next_value > @end_value
UPDATE table_num_schema
SET next_value =@start_value
WHERE Name = '[FSE Header ID]'

ELSE @



I am getting stuck though--the declared varriables need to equal certain information contained within the table_num_schema. I am unsure how to do this.
I also need to return a value (next_value) to the user for verification purposes. The next_value should be incremented by 1 each time this row is updated--hence the next_value. The increment is thus shown in the returned value and then verified.

Thanks in advance as I am very new to this!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top