In my database, I have a computed column based off of the ID field. Its formula is like so:
('Q'+right('00000'+CONVERT([varchar],[EnquiryID],(0)),(6)))
This means it’ll prepend 0’s upto 6 digits long. For example if my ID was 5, it’ll be Q000005. If its 100 it’ll be Q000100.
I’ve noticed that my ID is already at 4000 after just a few weeks. So my computed column looks like Q004000.
My question is, once it gets to say Q999999. Will it start at 1 again or add another 0 automatically? So will it go back to Q000001 or will it be Q1000000?
Let’s use our brain cells and logically analyze this:
EnquiryIDvalue goes to 1’000’000 – so yourCONVERT(varchar, EnquiryID, 0)returns1000000000001000000000000Qgiving you the result ofQ000000So I guess you better drop that computed column and re-create it with more digits! 🙂