[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Strange Problem



Hi,
        What DBMS are you using? If you are using Oracle here is what is
happening. Your Oracle NLS date format is 'dd-mon-yy' this means that when
you insert a date with a two digit year Oracle will attach the current
century, which is now 20 as opposed to 19,  onto the front of the year.
Hence you get 2099 instead of 1999. To correct this you can do one of two
things. You can change your Oracle NLS date format to 'dd-mon-rr' which is
the Oracle windowing format. This is the easiest and safest way to fix the
problem. Or you can find all of your date inserts and use the Oracle date
function to_date(&some_date,'dd-mon-rr') when you insert. I don't know about
other DBMS systems but I am sure they have something similar that you can
do.

Dan

        Hello All,
             I have a strange problem. I have a SQL statement in SQR. I
select a date
        from a table .Take for instance the date is c_dt, the database
variable is
        referenced as &c_dt.

        In the Insert statement in the same SQR , I'm inserting &c_dt into a
date field.
        The insert executes successfully. But surprisingly , a date
value(say
        01-jun-1999') is inserted as ('01-jun-2099').

        Could anyone throw some light on this ?. And let me know what the
problem is .
        Even though &c_dt is not a date variable but a character variable ,
it should
        have populated it as 19yy instead of 20yy right ?.


        Thanks in Advance.