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