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

Register | Login 

 
Realtime CMS Reporting from Infolytik (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: 58


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: 257


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: 58


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: 257


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
Bargleshark
Forum Member
Forum Member



Joined: 09 Dec 2014

Posts: 1



PostPosted: Tue Dec 09, 2014 5:38 am 
Post subject: Re: Some Date functions for Netezza

Thanks for posting this.

Are there any options for week?

Also found that I couldn't alternate add_months with add_weeks or add_days,
and getting errors on "Attribute DAY not found" if I left day out of quotation marks, or Function 'DATE_PART(UNKNOWN, INT4, TIMESTAMP)' does not exist if I put 'day' within quotes.
Back to top
Debbie
Forum Enthusiast
Forum Enthusiast



Joined: 01 Mar 2005

Posts: 2332
Location: Cheshire, England


flag
PostPosted: Tue Dec 09, 2014 10:55 am 
Post subject: Re: Some Date functions for Netezza

There are some netezza date functions in the Relative Dates sticky topic here:

http://www.forumtopics.com/busobj/viewtopic.php?t=152613

Might be worth updating the sticky with any new ones so it all gets kept in one place for posterity?

Debbie
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.0463 seconds using 17 queries. (SQL 0.0027 Parse 0.0349 Other 0.0088)
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