all groups > sql server dts > december 2004 >
You're in the

sql server dts

group:

Converting a date string to a date field



Converting a date string to a date field Cazian
12/20/2004 11:43:10 AM
sql server dts: I have a txt file that contains the date in a string format. I import this in
directly and it comes up a vchar instead of a date field. I need to convert
it to a date so I can do an index on it. I don't know if it is possible to do
in the DTS or if I should leave it how it is and then use a conversion in the
view. I see different things about VB on the board but I don't yet understand
how to implement that either in the DTS. I see that I can do a Cdate in VB
but how I put that into the correct column and have everything else come into
the table is beyond me at this point. Any advice would be gladly appreciated.

Thanks,
--
Re: Converting a date string to a date field Cazian
12/20/2004 2:13:17 PM
It does error out unfortunately. So in that case I will have to keep to how
it is and create a view off of it instead that does the conversion somehow.
So I guess I will see if I can figure out how to do that now instead. Thanks
for the quick reply.

Cazian


[quoted text, click to view]
Re: Converting a date string to a date field Allan Mitchell
12/20/2004 8:32:11 PM
What happens when you try to simply pump the "Text" Date into a proper
DateTime field?

There is no cute SQL that you can perform on the source before it gets to
the transformations because text files are about as flexible as me in a yoga
class.

You would have to perform manipulation if the above does not work in an
Active Script transform

Have a look here

Formatting Character Data into Datetime fields
(http://www.sqldts.com/default.aspx?249)

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


[quoted text, click to view]

AddThis Social Bookmark Button