how to generate invoice no

Jul 6 2008 1:39 AM
my case i have i table with identity column named invoices
when i insert in it the auto identity column assign a value
but i want the customer see the invoice no before i add it in the table
to use it in any search in th future is the any way

my q in another way

I have a form with a label that should show an invoice number. The invoice
number should be generated by sql Server using an autoincremented technique.
However, after reading several articles, it seems that I can only retrieve
this value after an INSERT has been done in the database. I want to find out
what this autoincremented before an insertion.

can i use  @@identity or scope_identity()in sql
and get the last identity and add 1 on them to show  customer the invoice no
or get the max value and increment 1 on it
is it solution or not

thnks in advice

Answers (2)