472,119 Members | 1,511 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

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 1189
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.