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.
 
Top