Re: [Tutor] Truncating a Table

2007-05-11 Thread Tim Golden
Leon Keylin wrote: > Same result. I think the problem maybe with the > extension module. It could be (try using the more recent pyodbc instead?) but in fact it worked for me, albeit in the toy example I posted. However, there's only so much mileage in working round a module's possible inadequaci

Re: [Tutor] Truncating a Table

2007-05-11 Thread Leon Keylin
on the dbserver used, but PostgreSQL for example requires commits for everything (including statements like CREATE TABLE). Andreas -- Ursprüngl. Mitteil. -- Betreff: Re: [Tutor] Truncating a Table Von:"Leon Keylin" <[EMAIL PROTECTED]> Datum: 11.05.2007 16:01 Yep, wor

Re: [Tutor] Truncating a Table

2007-05-11 Thread Andreas Kostyrka
Try commiting it. Actually that might depend upon the dbserver used, but PostgreSQL for example requires commits for everything (including statements like CREATE TABLE). Andreas -- Ursprüngl. Mitteil. -- Betreff:Re: [Tutor] Truncating a Table Von:"Leon Keylin" <[EM

Re: [Tutor] Truncating a Table

2007-05-11 Thread Tim Golden
Leon Keylin wrote: > Yep, works if I do it manually, under the same user. And on other tables? (Just trying to narrow down). Does this work: import pymssql db = pymssql (...) q = db.cursor () q.execute ("CREATE TABLE #a (i INT)") q.execute ("INSERT INTO #a (i) VALUES (1)") q.execute ("SELECT

Re: [Tutor] Truncating a Table

2007-05-11 Thread Andreas Kostyrka
You either have autocommit enabled or you need to commit all data changes. Can't tell the details as I'm not at my laptop :( Andreas -- Ursprüngl. Mitteil. -- Betreff: Re: [Tutor] Truncating a Table Von:"Leon Keylin" <[EMAIL PROTECTED]> Datum: 11

Re: [Tutor] Truncating a Table

2007-05-11 Thread Leon Keylin
Yep, works if I do it manually, under the same user. On 5/11/07, Tim Golden <[EMAIL PROTECTED]> wrote: Leon Keylin wrote: > Thanks Tim for a fast reply. > > The return gives me 0 Rows Truncated message and when I look at the table, > every record is still there. > There are no foreign keys on t

Re: [Tutor] Truncating a Table

2007-05-11 Thread Tim Golden
Leon Keylin wrote: > Thanks Tim for a fast reply. > > The return gives me 0 Rows Truncated message and when I look at the table, > every record is still there. > There are no foreign keys on the table and no errors. > > Andreas asked if I should commit after, should I? I didn't think I > needed

Re: [Tutor] Truncating a Table

2007-05-11 Thread Leon Keylin
Thanks Tim for a fast reply. The return gives me 0 Rows Truncated message and when I look at the table, every record is still there. There are no foreign keys on the table and no errors. Andreas asked if I should commit after, should I? I didn't think I needed to but I can try that. On 5/11/0

Re: [Tutor] Truncating a Table

2007-05-11 Thread Tim Golden
Leon Keylin wrote: > Why would this not work? > > import pymssql > > con = pymssql.connect(host='server > name',user='username',password='pwd',database='Database') > cur = con.cursor() > > > query="TRUNCATE TABLE Consolidatedmsgs;" > cur.execute(query) > print "Table Truncated: %d rows deleted"

Re: [Tutor] Truncating a Table

2007-05-11 Thread Andreas Kostyrka
Commit it? Andreas -- Ursprüngl. Mitteil. -- Betreff:[Tutor] Truncating a Table Von:"Leon Keylin" <[EMAIL PROTECTED]> Datum: 11.05.2007 15:39 Why would this not work? import pymssql con = pymssql.connect(host='server name',user='username

[Tutor] Truncating a Table

2007-05-11 Thread Leon Keylin
Why would this not work? import pymssql con = pymssql.connect(host='server name',user='username',password='pwd',database='Database') cur = con.cursor() query="TRUNCATE TABLE Consolidatedmsgs;" cur.execute(query) print "Table Truncated: %d rows deleted" % cur.rowcount --- The return I g