| From: | Josh Berkus <josh(at)agliodbs(dot)com> | 
|---|---|
| To: | Hernán Andrés Breinbauer Román <hernan(dot)breinbauer(at)netcas(dot)cl>, <pgsql-novice(at)postgresql(dot)org> | 
| Subject: | Re: migration problem in SQL Query with date filter | 
| Date: | 2002-10-07 20:59:51 | 
| Message-ID: | 200210071359.51409.josh@agliodbs.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-novice | 
Hernan,
See http://techdocs.postgresql.org .  There are several guides there for MS 
Access --> PostgreSQL migration.
> SELECT * FROM people WHERE timein > #3/1/2002 12:58# 
> 
> This statement selects all the records where "timein" is greater than March 
1 of 2002 and 12 hours 58 minutes AM.
> 
> The problem I have is how do I translate this kind of statement into SQL 
that postgresql understand while I retain compatibility with access.
> 
> I´m willing to change the code, but I need something that will work in 
Postgresql and access
Can't be done.  MS Access uses a non-standard delimiter for dates, namely the 
# sign.   Postgresql cannot accept the # sign in place of the SQL standard 
single-quote '.   You will have to have slightly different code for each 
database, or use an access library (such as ODBC) which does the 
transformation for you.
Postges will accept readily either:
SELECT * FROM people WHERE timein > '2002-03-01 12:58';
or
SELECT * FROM people WHERE timein > to_timestamp('3/1/2002 12:58','M/D/YYYY 
HH:MI');
-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chad Thompson | 2002-10-07 21:00:45 | Re: migration problem in SQL Query with date filter | 
| Previous Message | Hernán Andrés Breinbauer Román | 2002-10-07 20:50:56 | migration problem in SQL Query with date filter |