Unanswered: using bcp to output datetime in different format
Using SQL2K, and BCP to (very quickly) port a tables data to a .csv file is great!
However, the default format for the datetime values need to be YYYYMMDDhhmmss (with NO spaces).
I've been spinning my wheels trying to come up with a way to do this.
So far, this is what I have for the SELECT part - but, is there not an easier (or more elequent) way to accomplish this?
(bcp is a single line command, so conversion must remain in a single cmd)
-- format datetime to YYYYMMDDhhmmss with NO spaces
SELECT u_name, u_type,
str(year(u_datetime),4) + replace(str(month(u_datetime),2),' ','0') + replace(str(day(u_datetime),2),' ','0')
-- don't know how to do the time part ??