SQL Server Performance

Write to text destination only the 2006-03-13 and not 2006-03-13 00:00:00.000

Discussion in 'SQL Server 2005 Integration Services' started by Ismailc, Mar 4, 2008.

  1. Ismailc New Member

    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!
  2. kevriley New Member

    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
  3. Ismailc New Member

    Thank You very much, you are 100% correct my datatype is a datetime.replace
    (convert(varchar, WeekStDte, 102), '.', '-') as WeekDte
    Thank You very, very much.
    It works great!
  4. Ismailc New Member

    How do i convert it from: 2007-01-01 to: 01-01-2007
  5. satya Moderator

Share This Page