Ciao a tutti,
devo leggere e creare una tabella in un db esistente di ms access. Per leggere i dati: s = odbc.odbc('dbodbc') # mi collego al DSN cur = s.cursor() cur.execute("select STORICO.COD_ANAG,STORICO.DAT_STOR,STORICO.COD_CAU1,\ STORICO.THM_ORA_1,STORICO.COD_CAU2,\ STORICO.THM_ORA_2,ANAG.DES_ANAG\ from STORICO inner join ANAG on STORICO.COD_ANAG=ANAG.COD_ANAG\ where STORICO.DAT_STOR >= ? and STORICO.DAT_STOR <= ?\ order by STORICO.COD_ANAG,STORICO.DAT_STOR",\ (self.dtx_reg_ini,self.dtx_reg_fin,)) rec = cur.fetchall() recuperati i dati devo creare e popolare una tabella, sempre in ms access: #se esiste distrugge la tabella try: cur.execute("DROP TABLE stm") except: print "La tabella stm non esiste!" #crea tabelle stm cur.execute("CREATE TABLE stm (\ id int(2) NOT NULL auto_increment,\ cod char(10) value '',\ dattim char(8) value '',\ causa char(4) value '',\ ore char(4) value ' ',\ causaex char(4) value '',\ oreex char(4) value '',\ nome char(30) value '',\ PRIMARY KEY (id),\ )") quì cominciano i problemi: 1- non distrugge la tabella stm, infatti esegue l'istruzione except 2-lo script si arresta con il seguente errore: Traceback (most recent call last): File "C:\Python24\Lib\site-packages\WCronos.py", line 171, in OnOkButton cur.execute("CREATE TABLE stm (\ dbi.program-error: [Microsoft][Driver ODBC Microsoft Access] Errore di sintassi nell'istruzione CREATE TABLE. in EXEC Qualcuno conosce la sintassi giusta per i comandi DROP e CREATE per i driver ODBC per msaccess? Grazie. giorgio _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python