Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SSIS Export T-SQL String

Author  Topic 

benking9987
Posting Yak Master

124 Posts

Posted - 2010-07-06 : 18:00:54
I am trying to export the results of a query into a text (.txt) tab delimited file using an SSIS package. There is a particular column that is problematic. Its a date column that I need formatted like this (YYYY-MM-DD). Using this SQL, I can get the query to display what I need properly, however when the item exports, I am getting the time added onto the column value so I get YYYY-MM-DD HH:MM:SS. I need the " HH:MM:SS" dropped off from the export results.

CONVERT(VARCHAR(10), Ship_Date, 126) AS [ship-date]


The column "Ship_Date" is a datetime datatype

Any ideas?

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2010-07-07 : 03:11:01
Does the ship-time in the .txt-file have '00:00:00.000' as the time or does it have the exact time that was in the column before the conversion? If the txt-file has '00:00:00.000' it means that the column is converted back to the datetime datatype again before it gets written to file, but if it still has the original time from the data table it means that it never gets converted in the first place.

- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com
Go to Top of Page
   

- Advertisement -