Hi, I want to convert/write from my source to my text file: the date column. I have a date column of : 2006-03-13 00:00:00.000 but when it writes to flat destination i only want to write: 2006-03-13 Any ideas, Please assist! Regards
You would need to convert the datetime into a varchar, but there isn't a built in style for yyyy-mm-dd, so convert to yyyy.mm.dd (which is style 102), and then replace the '.' with '-' select replace(convert(varchar, date_column, 102), '.', '-') where date_column I am assuming is your date field in a datetime datatype
Thank You very much, you are 100% correct my datatype is a datetime.replace (convert(varchar, WeekStDte, 102), '.', '-') as WeekDte 2006-05-22 Thank You very, very much. It works great!
Refer to CONVERT function in Books ONline, that includes the code example and http://www.sql-server-performance.com/articles/dev/datetime_datatype_p1.aspx fyi