Formating a leading Zero in view

S

SF

Hi,

How do I format a Int field to display 000001 in SELECT INVOICEID FROM
TBLINVOICE

SF
 
S

SFAxess

I believe that is considered text.
You could convert to a vchar datatype and then prepend
the zeros for displaying purposes.
 
K

Karen Vaudreuil

SELECT RIGHT('000000' + CAST(INVOICEID AS varchar), 6) FROM TBLINVOICE

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

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

Top