Auto Incrementing Values

  • Thread starter Thread starter Lora Connors
  • Start date Start date
L

Lora Connors

I have an Invoice table in my database with 'InvoiceID' as
its primary key. I would like the InvoiceID field to auto
increment values in the format INV1, INV2,
INV3........INV100.so on and so forth. How do I go about
it?
Thanks!
 
Hi Lora,

That is a bad idea. Why don't you use numbers instead?
Anyway, you'll have to find the max key before inserting INVMAX+1.

select max(cast(substring(inv, 4,100) as numeric)) from tral
Will give you last inv number.
You should then increase it and insert INV+(MaxNumber+1).ToString() into
DataTable or something.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Combine into 1 1
Combining data from 2 tables 4
Allocate Payment 1
Increment table no by one, but don't add new record 2
incrementing key field 3
Running total in a form... 4
Form with subform 4
Allow Duplicates 20

Back
Top