• Yes, this is a much easier problem if you just use an integer identity field.  You could create a view using "STUFF(CAST(invoice_id as char(8)),3,0,'-') as invoice_id" for anything that insists on seeing it that way.

    I have tried for years to convince boneheads that if they want to see numbers with leading zeros, embedded dashes, etc, in their stupid spreadsheets then they should figure out how to format a column in Excel rather than try to dictate that I need to change all the numeric fields in the database to characters.  If you have better luck than I do, let me know how you do it.  Funny how after they run the data through Excel and lose all the leading zeroes they still want to blame the database.

    The last time someone whined about storing the leading zeroes I offered to print a binary dump of the data pages to prove that every 32-bit integer field did indeed have all of the leading zero bits intact.  I haven't had any complaints since then, but it's only a matter of time.