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
 General SQL Server Forums
 New to SQL Server Programming
 Casting DT_STR to Datetime

Author  Topic 

saiabhiram
Starting Member

17 Posts

Posted - 2010-05-12 : 17:19:22
Hello,

I have a field called start_date with a value 2004-10-28. The start date is being pulled from a flat file with a datatype DT_STR.
I need to put this in a field Start_dt in DB with datatype datetime.
what expression should I be using in the derived column.


Thanks so much in Advance

malpashaa
Constraint Violating Yak Guru

264 Posts

Posted - 2010-05-12 : 17:25:22
Use

CAST(start_date AS DATETIME)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-13 : 10:32:19
(DT_DBDATE)(DT_WSTR,30)yourdatefield

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -