[Tutor] Truncating a Table
Tim Golden
mail at timgolden.me.uk
Fri May 11 18:06:24 CEST 2007
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:
<code>
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 * FROM #a")
q.fetchall ()
q.execute ("TRUNCATE TABLE #a")
q.execute ("SELECT * FROM #a")
q.fetchall ()
q.execute ("DROP TABLE #a")
</code>
It works ok for me, so there's nothing
fundamentally wrong with the concept.
TJG
More information about the Tutor
mailing list