468,242 Members | 1,471 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

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
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
1 1125
ck9663
2,878 Expert 2GB
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.

Similar topics

9 posts views Thread by Ralph Cramden | last post: by
3 posts views Thread by Mark | last post: by
5 posts views Thread by Andy G | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.