Answered conditional split with date

  • Sunday, January 27, 2013 4:27 AM
     
     

    background: 15yrs informatica 2 weeks sqlserver 2008r - need to do for a POC

    I am using

    ((isnull(firstname)? "$0$" , first name ) != isnull(lkp_firstaname)?"$o$"  , lkp_firstname )          working well  no issues

    How do I do similar comparison for dates field  - Just format please - no explanation

    thx in advance

All Replies

  • Sunday, January 27, 2013 4:40 AM
     
     

    Sorry cannot test it

    ISNULL([date_column]) ? False : [date_column] < (DT_DBTIMESTAMP)"01/01/2012"

    http://www.sqlis.com/sqlis/post/Expression-Date-Functions.aspx


    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Blog: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance

  • Sunday, January 27, 2013 5:26 PM
     
     

    Sorry Uri - didn't work

    here is the the filter I want to use

    isnull(last_updatedate):? ''6666-12-12"  , last_updatedate != isnull( lkp_last_update_date):? ''6666-12-12" , lkp_last_updatedate)

    why this is not working

    any help appreciated

  • Sunday, January 27, 2013 5:52 PM
     
     

    if u want correct syntax try out this

    isnull(last_updatedate)? "6666-12-12"  : (last_updatedate != isnull( lkp_last_update_date)? "6666-12-12" : lkp_last_updatedate)

    but one thing i did nt get here is y are u comparing last_updatedate != isnull( lkp_last_update_date)

    i guess what u want is 

    isnull(last_updatedate)? "6666-12-12"  : (isnull( lkp_last_update_date)? "6666-12-12" : lkp_last_updatedate)

  • Sunday, January 27, 2013 7:58 PM
     
     

     this is what I want

    ((ISNULL(CAST(EFFECTIVE_DATE)) ? "6666-12-31" : CAST(EFFECTIVE_DATE) != (ISNULL(CAST(lkp_EFFECTIVE_DATE)) ? "6666-12-31" : CAST(lkp_EFFECTIVE_DATE))

  • Sunday, January 27, 2013 8:11 PM
     
     

    can someone pls give me correct syntax for

    isnull(CAST(EFFECTIVE_DATE))? "6666-12-31"  : (CAST(EFFECTIVE_DATE)) !=

    (ISNULL(CAST(lkp_EFFECTIVE_DATE)) ? "6666-12-31" : CAST(lkp_EFFECTIVE_DATE)

  • Sunday, January 27, 2013 9:15 PM
     
     Answered

    Hi,

    try

    (isnull([EFFECTIVE_DATE])?(DT_DATE)"6666-12-31" :([EFFECTIVE_DATE])) != (ISNULL([lkp_EFFECTIVE_DATE]) ? (DT_DATE)"6666-12-31" : [lkp_EFFECTIVE_DATE])

    Or post error info which is located (for few seconds) if you remain mouse pointer on red text in Expression box.
     
    Zdenek


    Please mark as helpful and propose as answer if you find this as correct. nosekz.eu