Avatar of jsctechy
jsctechy
Flag for United States of America

asked on 

Format a varchar in a select statement

hi,
I have this:
SELECT CAST(RIGHT('000000' + CAST(L_DATE  as varchar(6)), 6) as CHAR(6)) from TAX_ROLL
WHERE NUMBER_KEY ='0012345'

The above query returns this:
---------
080514

First Question:
How can i make that result to read 051408?

Second Question:
How do i removed the -------- if i dont provide the name of the column?

Thanks,
jsctechy
Microsoft SQL Server 2005

Avatar of undefined
Last Comment
jsctechy

8/22/2022 - Mon