BOB: Business Objects Board
Not endorsed by or affiliated with SAP

Register | Login 

 
Lead By Knowing (Opens a new window)  

General Notice: No events within the next 45 days.

Some Date functions for Netezza


 
Search this topic... | Search Semantic Layer / Universe Designer... | Search Box
Register or Login to Post    Forum Index -> Semantic Layer / Universe Designer  Previous TopicPrint TopicNext Topic
Author Message
mk19
Senior Member
Senior Member



Joined: 20 Jul 2009
ASUG Icon
Posts: 57


flag
PostPosted: Fri Dec 10, 2010 12:20 pm 
Post subject: Some Date functions for Netezza

Thought this might be helpful for Netezza Starters -- try these for different date calculations:

---------------------------------------------------------------
SELECT
date(current_Date) from dual;

select add_months(current_date,-1) - date_part('day', current_date)
from dual;

select add_months(current_date,1) - date_part('day', current_date)
from dual;

select date_part('day', current_date)
from dual;

select date_part('month', current_date)
from dual;

select add_months(current_date,0)
from dual;

select add_months(current_date,-1)
from dual;

select add_months(current_date,-1) - date_part('month', current_date)
from dual;

select add_months(current_date,0) - date_part('day', current_date)
from dual;
------------------------------
Back to top
americanmc
Principal Member
Principal Member



Joined: 30 Dec 2009

Posts: 243


flag
PostPosted: Mon Dec 13, 2010 3:44 pm 
Post subject: Re: Some Date functions for Netezza

The syntax is great, Can you add the Date values as well, for example,
add_months(sysdate,-1) will give last month.... something like that...

_________________
Did you think that man was created for nothing and that one day he would not have to return to his Lord?
Back to top
mk19
Senior Member
Senior Member



Joined: 20 Jul 2009
ASUG Icon
Posts: 57


flag
PostPosted: Mon Dec 13, 2010 3:55 pm 
Post subject: Re: Some Date functions for Netezza

Yes, you can get previous months -- select add_months(current_date,-1)
from dual;

Please note that Netezza uses current_date as opposed to sysdate in oracle.
Back to top
americanmc
Principal Member
Principal Member



Joined: 30 Dec 2009

Posts: 243


flag
PostPosted: Mon Dec 13, 2010 4:08 pm 
Post subject: Re: Some Date functions for Netezza

What I mean is that your syntax below, what is it getting, yesterday, last week??...
so please can you write naem value for all your syntax...thanks

Code:
select add_months(current_date,-1) - date_part('day', current_date)
from dual;


_________________
Did you think that man was created for nothing and that one day he would not have to return to his Lord?
Back to top
Display posts from previous:   
Register or Login to Post    Forum Index -> Semantic Layer / Universe Designer  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 5 Hours
 
Jump to:  

Index | About | FAQ | RAG | Privacy | Search |  Register |  Login 

Get community updates via Twitter:

Not endorsed by or affiliated with SAP
Powered by phpBB © phpBB Group
Generated in 0.0445 seconds using 17 queries. (SQL 0.0025 Parse 0.0347 Other 0.0073)
CCBot/2.0 (http://commoncrawl.org/faq/)
Hosted by ForumTopics.com | Terms of Service
phpBB Customizations by the phpBBDoctor.com
Shameless plug for MomentsOfLight.com Moments of Light Logo