By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,806 Members | 1,837 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,806 IT Pros & Developers. It's quick & easy.

what's the wrong with this stored procedure

P: 11
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
Expand|Select|Wrap|Line Numbers
  1. create proc TickIDStart 
  2. (
  3. @IDnew int
  4. )
  5. as
  6.     BEGIN
  7. set nocount on
  8. -- Allow the insert in the identity column
  9. SET IDENTITY_INSERT TCKTs ON
  10. --Insert any data and delete it to adjust the identity column    
  11. 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)
  12. delete from TCKTs where TCKT_ID= @IDnew
  13. --Disable the insert in the identity column
  14. SET IDENTITY_INSERT TCKTs Off    
  15.     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
Dec 31 '08 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
Can't you just reset it?

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

-- CK
Dec 31 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.