Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using currentdate function in a SQL Expression 1

Status
Not open for further replies.

pl1101

Programmer
Dec 5, 2009
46
Hello, I am not sure if anyone has had this problem, but I am trying to use the date criteria in a sql expression. I can do it manually, but is there a way to make the field = month(currentdate)? When I put this in a sql expression it says column currentdate not in specified tables. What is it looking for?

Please help
Thank you!!
 
Depends on your database.

MS SQL use Getdate()

Oracle use sysdate, but Oracle does not have the function Month(). You would have to convert to char, then extract string and convert to number.

Ian
 
I am using AS400 and Crystal XI release 2
 
Ian,

Oracle does have a month function-> {fn month()}

Maybe it depends upon the driver used though.

pl1101,

Look in the field list for a function like "Now" or "Curdate". These functions can then be nested within the month function as in,

{fn month({fn curdate()})}

Not sure what functions are available for AS400.

-LB
 
Great that worked. I did not know that Crystal gave other options in the field list. That will help me in the future. Thank you sooo much

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top