dbTalk Databases Forums  

[BUGS] Insert statement changes timestamp value from MS Access ODBC

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Insert statement changes timestamp value from MS Access ODBC in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David Dabney
 
Posts: n/a

Default [BUGS] Insert statement changes timestamp value from MS Access ODBC - 07-27-2005 , 01:56 PM






This is a multi-part message in MIME format.
--------------080300000803020808050609
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Please see attached text document.

Thanks,

Dave

David Dabney
OHH Database Specialist/Programmer
Hollings Marine Lab
131 Fort Johnson Road
Charleston, SC 29464
843.762.8984




--------------080300000803020808050609
Content-Type: text/plain;
name="LUCES_WQ_import_issues.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="LUCES_WQ_import_issues.txt"

insert into public_collection (original_collection_code, method, station_id, date_time, sampling_project_id, contributor)
select LUCES_wq.deploy_code, LUCES_wq.method, LUCES_wq.station_id, Min(LUCES_wq.datetime) AS MinOfdatetime, 12, 1
FROM LUCES_wq
GROUP BY LUCES_wq.deploy_code, LUCES_wq.method, LUCES_wq.station_id
ORDER BY LUCES_wq.deploy_code



INSERT INTO public_wq ( original_deployment_code, collection_id, date_time, water_temp, ph, sp_cond, salinity, do_per, do_mg_l, depth_m )
SELECT deploy_code, c.id, datetime, water_temp, ph, sp_cond, salinity, do_sat, do_mg_l, depth_m
FROM LUCES_wq as lwq
INNER JOIN public_collection as c on lwq.deploy_code = c.original_collection_code




INSERT INTO public_wq ( original_deployment_code, collection_id, date_time, water_temp, ph, sp_cond, salinity, do_per, do_mg_l, depth_m)
SELECT deploy_code, c.id, datetime, water_temp, ph, sp_cond, salinity, do_sat, do_mg_l, depth_m
FROM LUCES_wq as lwq
INNER JOIN public_collection as c on lwq.deploy_code = c.original_collection_code
WHERE c.id <=1980


INSERT INTO public_wq ( original_deployment_code, collection_id, date_time, water_temp, ph, sp_cond, salinity, do_per, do_mg_l, depth_m)
SELECT deploy_code, c.id, datetime, water_temp, ph, sp_cond, salinity, do_sat, do_mg_l, depth_m
FROM LUCES_wq as lwq
INNER JOIN public_collection as c on lwq.deploy_code = c.original_collection_code
WHERE c.id <=1981
and c.id >1980

TEST IN EMS
insert into public.wq (collection_id, date_time, original_deployment_code, water_temp, depth_m, salinity, sp_cond, do_per, do_mg_l, ph) values (1982,'4/1/2001 3:00:00','MLM20010327',17.67,1.64,30.20,46.40,72.8 0,5.84,7.61)

psql
COPY wq ( collection_id , date_time , original_deployment_code , water_temp , depth_m , salinity , sp_cond , do_per , do_mg_l , ph ) FROM '/usr/local/pgsql/ddluces.csv' CSV;
COPY
ohh_v8=#

Deleted inserted records and tried to do in Access with ' ' around datetime. Access gives type mismatch. Tried query w/out. Now it works.
Should we always concatenate to insert date_time?

Now all the sudden this works.
INSERT INTO public_wq ( original_deployment_code, collection_id, date_time, water_temp, ph, sp_cond, salinity, do_per, do_mg_l, depth_m)
SELECT deploy_code, c.id, datetime, water_temp, ph, sp_cond, salinity, do_sat, do_mg_l, depth_m
FROM LUCES_wq as lwq
INNER JOIN public_collection as c on lwq.deploy_code = c.original_collection_code
WHERE c.id >=1982

--------------080300000803020808050609
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly

--------------080300000803020808050609--

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.