SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS convert to date issue


SSIS convert to date issue

Author
Message
avishain
avishain
SSC Rookie
SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)

Group: General Forum Members
Points: 26 Visits: 115
im developing an ssis package.

while im in the sql server , there is a field that contains a text string , for example:

December 13, 2008

and so on...

i want to convert it to 2008-12-13 00:00:00.000 or 2008-12-13 (its same for me)

so, in the sql server i can do it with this statement:

SELECT convert(datetime,myfiled, 107)

FROM ....

the question is , what is the equivalent statement to it within the SSIS 2008 ? (with derived column)

thank you
robert.gerald.taylor
robert.gerald.taylor
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1791 Visits: 1484
avishain (1/21/2013)
im developing an ssis package.

while im in the sql server , there is a field that contains a text string , for example:

December 13, 2008

and so on...

i want to convert it to 2008-12-13 00:00:00.000 or 2008-12-13 (its same for me)

so, in the sql server i can do it with this statement:

SELECT convert(datetime,myfiled, 107)

FROM ....

the question is , what is the equivalent statement to it within the SSIS 2008 ? (with derived column)

Why not just do it in your source SQL as you described above? Or is the datasource not from SQL Server?

If not, take a look at: http://toddmcdermid.blogspot.com/2008/11/converting-strings-to-dates-in-derived.html#!/2008/11/converting-strings-to-dates-in-derived.html

HTH,
Rob
avishain
avishain
SSC Rookie
SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)

Group: General Forum Members
Points: 26 Visits: 115
the DS would be an XML file.... so i have to this within the ssis package Smile
quillis131
quillis131
SSC Veteran
SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)

Group: General Forum Members
Points: 258 Visits: 572
avishain (1/21/2013)
im developing an ssis package.

while im in the sql server , there is a field that contains a text string , for example:

December 13, 2008

and so on...

i want to convert it to 2008-12-13 00:00:00.000 or 2008-12-13 (its same for me)

so, in the sql server i can do it with this statement:

SELECT convert(datetime,myfiled, 107)

FROM ....

the question is , what is the equivalent statement to it within the SSIS 2008 ? (with derived column)

thank you





Here is expression you needed

(DT_STR,4,1252)YEAR((DT_DBDATE)"January 22, 2008") + "-" + (DT_STR,2,1252)MONTH((DT_DBDATE)"January 22, 2008") + "-" + (DT_STR,2,1252)DAY((DT_DBDATE)"January 22, 2008")
quillis131
quillis131
SSC Veteran
SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)

Group: General Forum Members
Points: 258 Visits: 572
Here is expression you needed

(DT_STR,4,1252)YEAR((DT_DBDATE)"January 22, 2008") + "-" + (DT_STR,2,1252)MONTH((DT_DBDATE)"January 22, 2008") + "-" + (DT_STR,2,1252)DAY((DT_DBDATE)"January 22, 2008")
sqlbi.vvamsi
sqlbi.vvamsi
SSC-Enthusiastic
SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)

Group: General Forum Members
Points: 102 Visits: 412
type casting that column to dt_dbtimestamp should work
avishain
avishain
SSC Rookie
SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)

Group: General Forum Members
Points: 26 Visits: 115
sqlbi.vvamsi (1/22/2013)
type casting that column to dt_dbtimestamp should work


Works like a charm Smile


thank you
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search