December 12, 2008 at 11:22 am
It will error exactly because of the deletes, as I said in the article.
This kinds of things are requires because it's one of the rules of the quality of service isos. You should have rules on document numbering/labeling and they recommend that a different kind of document should have a diferent numbering. Sample:
Invoices: INV20080001 that is INC Year sequence
Receipts: REC20080001 that is REC Year sequence
or like this
INV - 1 - 2008
REC - 1 - 2008
That's why it's required, and u probably see it every time, on the web, on the coffee-shop, .....
December 12, 2008 at 11:58 am
Thanks for all replies.
After all this posts, I think I will do my best to try to convince my client to accept simple ever increasing Order numbers, based on Identity primary key. I couldn't imagine that having generated sequential number can produce so much troubles.
One of points here will be that sometimes Identity can produce holes by itself, although this doesn't have to be so big problem. One of situations where identity number will be skipped is starting to insert new record, and then cancel it. This is at least case when inserting directly through GUI of SQL Management Studio, but I didn't try to do it through .Net application, and Datasets, which will be my front-end.
If client will still require described numbering system, then I think I will go to stored procedure approach with separate sequence table. In one of posts, someone said that I should avoid using triggers for that purpose. What is the reason ?
December 12, 2008 at 12:22 pm
Skull Killer (12/12/2008)
It will error exactly because of the deletes, as I said in the article.
What article????? Wow it really must be Friday - I'm feeling my brain seep out of my ears......
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
December 13, 2008 at 9:15 am
Matt Miller (12/12/2008)
Skull Killer (12/12/2008)
It will error exactly because of the deletes, as I said in the article.What article????? Wow it really must be Friday - I'm feeling my brain seep out of my ears......
I wanted to say post.
About triggers: If you want to do something different, that shouldn't use the trigger, let's say for instance, insert a previous deleted record into the table again, u would have to disable the trigger or something like that. With sps u make a sp for each kind of situation u need and then choose what u want to execute or not to execute any. It's much cleaner too, in my opinion. U can have a sp to insert new orders and another to insert previous deleted order. This way, if u need to archive data e recover that data back into the table u won't have to worry about the sps nor triggers.
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply