I'm making a sequence number form Certificate of Insurance booklet given to the agents so that the CI numbers can be tracked. My code is attached below:
- CREATE PROCEDURE [dbo].[CI_SEQUENTIAL_Number]
- (
- @StartingNumber int,
- @EndingNumber int,
- @Header int
- )
- AS
- DECLARE @start int
- DECLARE @end int
- SELECT @start = @StartingNumber, @end = @EndingNumber
- WHILE @start <= @end
- begin
- INSERT INTO dbo.tblSeriesDetails
- (SeriesNumbers)
- VALUES(@start)
- SET @start = @start + 1
- where SeriesHeader_Id = @Header error in this area.
- END
Msg 156, Level 15, State 1, Procedure SEQUENTIAL, Line 25
Incorrect syntax near the keyword 'where'." Still newbie and still acquiring knowledge in sql server. Thanks for any help.


Amit GuptaRank #190 · 12.8K reputationPosted Mar 25, 2017, 9:16 AM EDT
Jes SieRank #1,285 · 1.3K reputationPosted Mar 25, 2017, 9:45 PM EDT
Rajeev PunhaniRank #551 · 4.4K reputationPosted Mar 25, 2017, 7:31 AM EDT
Bryian TanRank #396 · 6.3K reputationPosted Mar 25, 2017, 11:54 AM EDT