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.
Author |
Topic |
jscot
Posting Yak Master
106 Posts |
Posted - 2011-03-09 : 20:43:26
|
Here is my sample data and field called "date_1"29-SEP-10 12.00.00.000000000 AM24-MAY-10 12.00.00.000000000 AM11-MAR-03 12.00.00.000000000 AM24-FEB-03 12.00.00.000000000 AM17-JUN-03 12.00.00.000000000 AM13-DEC-02 12.00.00.000000000 AM30-DEC-02 12.00.00.000000000 AM and my target field is "DATE"and data type is "date time"I think my target field can accept date like this24-5-1024-2-03 and so on. Please help me out. Thanks. |
|
latch
Yak Posting Veteran
62 Posts |
Posted - 2011-03-11 : 11:29:25
|
Hi,If the input date is coming from Flat file source and destination is also flat file then:Take a script component:Inside the input block: string s = "null"; s = Row.DD.ToString(); s = s.Substring(0, 9); string m = "null"; m = s.Substring(3, 3); switch (m) { case "JAN": m = "01"; break; case "FEB": m = "02"; break; case "MAR": m = "03"; break; case "APR": m = "04"; break; case "MAY": m = "05"; break; case "JUN": m = "06"; break; case "JUL": m = "07"; break; case "AUG": m = "08"; break; case "SEP": m = "09"; break; case "OCT": m = "10"; break; case "NOV": m = "11"; break; case "DEC": m = "12"; break; } Row.newdate = s.Substring(0, 3) + m + s.Substring(6, 3);newdate is the output of type dt_str.Thanks,latch |
|
|
|
|
|