I was able to answer my own question.
In order to get the format i needed, which was "YYMMDD", i used this sql
formatting:
set dateformat ymd
select
right(datepart(year, mytable.SODATE),2) + RIGHT(REPLICATE('0',2) +
CONVERT(VARCHAR(2),datepart(month,mytable.SODATE)),2) +
RIGHT(REPLICATE('0',2) +
CONVERT(VARCHAR(2),datepart(day,mytable.SODATE)),2) as SODATE
from
mytable
Andres
-----Original Message-----
From: Andres
Sent: Wednesday, March 06, 2002 9:33 AM
To: CF-Talk
Subject: padding results in an SQL query
How can in pad an sql result with a character?
I am trying to set my dates to be formatted as YYMMDD for a report i
need. I am using SET DATEFORMAT ymd to format the date in the correct
part order, but my day digits come as a single for 1 to 9.
Does anyone know how to make it look like "000101" for January 1st,
2000?
Right now, what i get is "00101".
ps. This must be done in SQL, not using CF.
Thank you!
______________________________________________________________________
Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists