Hi John, <br><br>Here's the code (I do have permissions to truncate, works manually under the same user. <br><br><br>import pymssql<br><br>con = pymssql.connect(host='server',user='user',password='pwd',database='DB_QA')
<br>cur = con.cursor()<br><br><br>query="truncate TABLE bbConsolidatedMessageAcks"<br>cur.execute(query)<br>print "Deleted Records: %d" % cur.rowcount<br><br><br><br><br><br>On Monday 21 May 2007 16:21, Leon Keylin wrote:
<br>> Thanks Mike, unfortunately that's the mod I had problems with before. The<br>> one that<br>> can't do truncate. I've written about it before here and it was easier to<br>> look for<br>> another solution.
<br>><br>> Is there any other way? Should I be looking for a different language to do<br>> it in?<br>><br>> > -----Original Message-----<br>> > From: <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:tutor-bounces@python.org">
tutor-bounces@python.org</a><br>> > [mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:tutor-bounces@python.org">tutor-bounces@python.org</a>] On Behalf Of Leon Keylin<br>> > Sent: Monday, May 21, 2007 3:52 PM
<br>> > To: <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:tutor@python.org">tutor@python.org</a><br>> > Subject: [Tutor] MS SQL Connection<br>> ><br>> > Been trying to do a very small and simple select via Python.
<br>> > First I tried a module that looked clean but it couldn't<br>> > truncate tables.<br>> ><br>> > Then I started sifting through docs at <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://python.org/" target="_blank">
python.org</a> and<br>> > couldn't find a simple<br>> > way of communicating with a MS SQL via Python program.<br>> ><br>> > Do I have to use ODBC?<br>> ><br>> > Any examples would be awesome. Thanks!
<br>><br>> I did a quick search on Google for MS SQL Python, and this came up. It<br>> looks like it will do the trick.<br>><br>> <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://pymssql.sourceforge.net/" target="_blank">
http://pymssql.sourceforge.net/</a><br>><br>> Mike<br>>Mike I just tried it and it worked using pymssql-0.8.0. Could you post the<br>>code you are using to truncate? Also is it possible you don't have<br>
> permission to truncate?<br><br>> John Fabiani<br><br>On Monday 21 May 2007 16:21, Leon Keylin wrote:<br>> Thanks Mike, unfortunately that's the mod I had problems with before. The<br>> one that<br>> can't do truncate. I've written about it before here and it was easier to
<br>> look for<br>> another solution.<br>><br>> Is there any other way? Should I be looking for a different language to do<br>> it in?<br>><br>> > -----Original Message-----<br>> > From: <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:tutor-bounces@python.org">
tutor-bounces@python.org</a><br>> > [mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:tutor-bounces@python.org">tutor-bounces@python.org</a>] On Behalf Of Leon Keylin<br>> > Sent: Monday, May 21, 2007 3:52 PM
<br>> > To: <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:tutor@python.org">tutor@python.org</a><br>> > Subject: [Tutor] MS SQL Connection<br>> ><br>> > Been trying to do a very small and simple select via Python.
<br>> > First I tried a module that looked clean but it couldn't<br>> > truncate tables.<br>> ><br>> > Then I started sifting through docs at <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://python.org/" target="_blank">
python.org</a> and<br>> > couldn't find a simple<br>> > way of communicating with a MS SQL via Python program.<br>> ><br>> > Do I have to use ODBC?<br>> ><br>> > Any examples would be awesome. Thanks!
<br>><br>> I did a quick search on Google for MS SQL Python, and this came up. It<br>> looks like it will do the trick.<br>><br>> <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://pymssql.sourceforge.net/" target="_blank">
http://pymssql.sourceforge.net/</a><br>><br>> Mike<br>Mike I just tried it and it worked using pymssql-0.8.0. Could you post the<br>code you are using to truncate? Also is it possible you don't have<br>permission to truncate?
<br>--<br>John Fabiani<br><br>