Link to home
Start Free TrialLog in
Avatar of Ricky White
Ricky WhiteFlag for United States of America

asked on

How to implement invoice number functionality?

Environment: C#.Net, Sql Server

I need to create an invoice number in an application which is auto generated for each account.

Below are the 2 options I know. Please advise what would be the best approach to implement this functionality.

Options:
1). Identity column
2). Create a table in SQL Server that has just 1 column and 1 row. and insert number 1 in there. Now everytime, I want to create an invoice number I can read the value from this counter table and add 1.

Thanks.
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Both options you say are fairly poor - for the reasons already stated.

I note you also haven't actually told us what format the invoice number is or what requirements it has.
Avatar of Ricky White

ASKER

Thanks.