SQL Server Performance

Cast/Conv Expression remove the slash:02/02/2008 and output:20080202 (int)

Discussion in 'SQL Server 2005 Integration Services' started by Ismailc, Mar 27, 2008.

  1. Ismailc New Member

    Hi, I need help please.
    I have text source & i need to write it to table field being an integer.
    I complains about the column, so i added a derived column but I am clueless in the expression:
    Source from text: 02/02/2008
    Derived column expression to output: 20080202 in a int datatype

    I need the expression to do it.
    Please Assist!
  2. satya Moderator

  3. Ismailc New Member

    Hi, Thank You for the assist.
    But i need to put it in an expression in a Derived column.
    I found this but can't get it going:(DT_UI4)((DT_STR,4,1252)YEAR([Trx_Date]) + (DT_STR,4,1252)MONTH( [Trx_Date]) + (DT_STR,4,1252)DAY( [Trx_Date]))
    Data type: four byte unsigned
    Error: The function Year does not support the data type DT_UI4 for parameter 1. Has errors such as divide by zeros.

    Please Assist!
  4. Ismailc New Member

    Hi, got it going!
    My expression did not work becuase the year/month/day only works if the datatype is datetime.
    So i done a DataConversion to: database timestamp
    and then derived column:(DT_STR,4,1252)YEAR([Copy of Trx_Date]) + RIGHT("00" + (DT_STR,2,1252)MONTH([Copy of Trx_Date]),2) + RIGHT("00" + (DT_STR,2,1252)DAY([Copy of Trx_Date]),2)

    Thank You ALL

Share This Page