×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Informix Current Date Value - SQL Update

Informix Current Date Value - SQL Update

Informix Current Date Value - SQL Update

(OP)
I'm attempting to update a row in an Informix database through a SQL task.  I have the following line of code working:

UPDATE SYNC SET LASTSYNCEDATE = '1-3-2007' WHERE TABLENAME = 'X'

My problem is that I can't seem to find something similar to Now() or GetDate() in the Informix world.  Any help would be GREATLY appreciated.

RE: Informix Current Date Value - SQL Update

(OP)
Something else I thought of is that I can also query a secondary table for the maximum of a change date field.  Here I would just need to know how to query the Max value.

Thanks again.

RE: Informix Current Date Value - SQL Update

the informix keyword for "now" is "current"

so you could so:

CODE

UPDATE SYNC SET LASTSYNCEDATE = current WHERE TABLENAME = 'X';

but be careful: in a stored procedure environment this value is only updated once per procedurecall, so within a loop it will always have the same value.

RE: Informix Current Date Value - SQL Update

concerning the "max-question"

i do not really understand what you exactly want to do, but a syntax for your problem would be something like that:

CODE

select * from table1
where datefield = (select max(otherdatefield) from table2);

RE: Informix Current Date Value - SQL Update

(OP)
I had tried to use current but figured it was not valid since it returns the following error:

Error Source: Microsoft OLE DB Provider for ODBC Drivers
Error Description: [Ardent][UVODBC][1400832]Error ID: 29 Severity: ERROR Facility: FPSRVERR - Line 3, column 35 (around "current"): Syntax error.

RE: Informix Current Date Value - SQL Update

please check your syntax and/or post your statement containing current.

it must look like this:

update table
set field=current ...

and NOT

update table
set field = "current" ...
 

RE: Informix Current Date Value - SQL Update

And what about this ?
UPDATE SYNC SET LASTSYNCEDATE = TODAY WHERE TABLENAME = 'X'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886

RE: Informix Current Date Value - SQL Update

OrWolf, just to know, didn't TODAY (instead of CURRENT) solve your issue ?

RE: Informix Current Date Value - SQL Update

(OP)
TODAY was also returned as a syntax error.  I ended up having to scrap the update and find an alternate work around.

RE: Informix Current Date Value - SQL Update

Seems more like an ODBC driver issue than an Informix syntax.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close