I am using a simple input from an SQL data base where I have 4 dates defined as type D. I am writing to a flat file with the fileds defined with any available date format and the output on the flat file comes out as "mm/dd/yy 00:00". I'd like to just have the date portion with no time. The input does not have a time on it so I understand the 00:00 as the value. It seems that I shouldn't have to do any extra work as it is date to date. I've seen the gyrations for a date from the SQL database when it is a character field, but that's not the issue here.
Thanks!
how does your sql data looks like? mm/dd/yyyy hh:mis?
if you are using a data flow task, you may want to add data conversion transformation to it, to convert to your required format.
|||In your source, use a SQL statement to retrieve the records. For the four date fields, use the following code:CONVERT(varchar(20), yourDateField, 101)|||The fields are not character - they are defined as date fields in the SQL table.|||It is shown on the table layout as a "D" type with 0 length.|||That is why Phil asked you to convert into varchar with your required format in sql command.
Thanks|||
JLBSYS wrote:
The fields are not character - they are defined as date fields in the SQL table.
Yeah, I know. This converts them to character strings. Try it in management studio to see what it does.
OR your other option is to take what you've currently got built and add a derived column to create a new column that casts the date/time fields to DT_DBDATE fields.|||
This is what I did since I had to work a few other fields also. I was just wondering why you had to go through gyrations to get an input date to an output date. Since you can select the format on the ADVANCE option of the output connection manager for the Flat file. Changing the format does not change the output.
Thanks everyone for quick response!
No comments:
Post a Comment