will this query works...

  • Hi friends... can anyone tell me if this query works fine or not...

    case WHEN substr(to_char(cdate,'day'),1,3)='sat' THEN 'Holiday'

    WHEN substr(to_char(cdate,'day'),1,3)='sun' THEN 'Holiday'

    Else leavec.leavetype

    end as dayname

    from date_dim inner join leavec

    on date_dim.CDATE=leavec.trandatetime

    Thanks in advance,

    Deepthi

  • Have you tried it ?

    Did it run fine ?



    Clear Sky SQL
    My Blog[/url]

  • I'm not sure if you're referring to whether it will work against an Oracle or SQL Server data source? To_char and substr are oracle syntax - you need to look up DATENAME and SUBSTRING in BOL for the SQL Server equivalents.

    Is that what you're after?

  • ...and you are assuming your database language is english

  • deepthik (9/27/2010)


    Hi friends... can anyone tell me if this query works fine or not...

    Hard to say, we do not know what are you trying to achieve 🙂

    As Dave said you have to test it, this is not brain surgery therefore you are allowed to test and see what happens 😀

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • It might work if you add the word SELECT in front of it.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply