Formating a leading Zero in view

  • Thread starter Thread starter SF
  • Start date Start date
I believe that is considered text.
You could convert to a vchar datatype and then prepend
the zeros for displaying purposes.
 
SELECT RIGHT('000000' + CAST(INVOICEID AS varchar), 6) FROM TBLINVOICE

The Cast function is not necessary if InvoiceId is already a character
field.
 
Back
Top