Home Forums Data Warehousing Integration Services how to check whether in the given column we have values in date format RE: how to check whether in the given column we have values in date format

  • manibad (4/19/2013)


    I found a method to achieve my goal in derived column in SSIS.

    the code is:

    ((SUBSTRING(Variable,3,1)=="/"&&SUBSTRING(Variable,6,1)=="/")||

    (SUBSTRING(Variable,3,1)=="/"&&SUBSTRING(Variable,5,1)=="/")||

    (SUBSTRING(Variable,2,1)=="/"&&SUBSTRING(Variable,4,1)=="/")||

    (SUBSTRING(Variable,2,1)=="/"&&SUBSTRING(Variable,5,1)=="/")||

    (SUBSTRING(Variable,3,1)=="-"&&SUBSTRING(Variable,6,1)=="-")||

    (SUBSTRING(Variable,3,1)=="-"&&SUBSTRING(Variable,5,1)=="-")||

    (SUBSTRING(Variable,2,1)=="-"&&SUBSTRING(Variable,4,1)=="-")||

    (SUBSTRING(Variable,2,1)=="-"&&SUBSTRING(Variable,5,1)=="-"))?

    (DT_STR,8,1252)(REPLACE((DT_WSTR,10)(DT_DBDATE)Variable,"-","")):REPLICATE(" ",8)

    but here in this code i have a glitch..

    the glitch is if suppose the data is like xx/yy/mmmm then it will throw a error..and i dunno how to rectify this glltch.for now we haven't stored such sort of data but still i want to rectify this glitch so can anyone please help me.

    Thanks in advance.

    The output of the code would be

    variable=1/31/2013 o/p=20130131

    variable=31/2013 o/p=<space>

    Thanks.