September 27, 2010 at 1:18 am
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
September 27, 2010 at 1:48 am
September 27, 2010 at 2:19 am
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?
September 28, 2010 at 4:37 am
...and you are assuming your database language is english
September 28, 2010 at 4:32 pm
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.September 30, 2010 at 11:25 am
It might work if you add the word SELECT in front of 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