what's the wrong with this stored procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AliHabib
    New Member
    • Dec 2008
    • 11

    #1

    what's the wrong with this stored procedure

    I write this stored procedure to modify the identity column depending on entered value it worked well just one time but now not work how can i fix this problem
    Code:
    create proc TickIDStart 
    (
    @IDnew int
    )
    as
    	BEGIN
    set nocount on
    -- Allow the insert in the identity column
    SET IDENTITY_INSERT TCKTs ON
    --Insert any data and delete it to adjust the identity column	
    insert into TCKTs (TCKT_ID,TCKT_DESC, TCKT_SEVERITY_ID, Open_User_ID, RPT_USER_ID, TCKT_SUB_PROJ_ID) values (@IDnew,'text', 1, 1598,1610,122)
    delete from TCKTs where TCKT_ID= @IDnew
    --Disable the insert in the identity column
    SET IDENTITY_INSERT TCKTs Off	
    	END
    it's apart of project that we need to change the start of id with the year

    for ex : 200800023
    tommorow we need to 200900001
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Can't you just reset it?

    You can specify the starting point when you reset it. Read more here

    -- CK

    Comment

    Working...