473,794 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pymssql stored procedures - NEW THREAD

On Tue, 21 Oct 2008 20:44:24 +0200, Mike Hansen <pr**********@y ahoo.com>
wrote:
Hi,

I saw your posting on the python list about pymssql and you mentioned
that you call stored procedures and get back output parameters. Are you
doing this on Windows or Linux? I can't seem to get it to work on Linux.
Have you gotten it to work on Linux?

See this discussion on stackoverflow:

http://stackoverflow.com/questions/1...dure-in-python

Thanks

Hi there

I hope you don't mind - I made this a new thread on the list, so others
can maybe help out.

Although I use Linux quite often, I'm afraid MS SQL (with python) from
Linux is something I have not tried yet. :-/

However - here are some things you might try:
1) On the pymssql site (http://pymssql.sourceforge.net/#platforms) there
is some documentation on using MS SQL (specifically with pymssql) from
Linux - you need to use FreeTDS (http://www.freetds.org/) [although you
probably know this already so... :)]
2) (The following I have *only* tried on windows xp and server 2003 and
SQL Server 2000)
I have tried various suggested ways to have pymssql (and indeed a
couple of other python db libraries - which didn't work) - from extensive
googling etc., return an output parameter for MS SQL server. The only
method that works, for me at least, is the following - using pymssql:
* Assume stored procedure called : "sp_GetUser ID" that has an output
parameter declared as "@id".
* Instead of using the "callproc" method of a cursor instead I execute
the stored procedure as a normal sql statement that would return rows.
import pymssql
con = pymssql.connect (host='xxxxx',u ser='xxxx',
password='xxxxx ',database='xxx xx')
cur = con.cursor()
query = "DECLARE @id INT; EXECUTE sp_GetUserID; SELECT @id;"
cur.execute(que ry)
outputparameter = cur.fetchall()
con.commit()
con.close()

* You should now be able to access the output parameter from the list
object "outputparamete r".

HTH

Regards

Nicol

Let me know if thats a bit unclear - it's a bit late here :-p
--
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo
Oct 21 '08 #1
0 1431

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1486
by: Josh Close | last post by:
I'm getting an error from pymssql when trying to execute a stored procedure: Operating-system Error - OpenClient I can't figure out why this is happening. It's probably a freetds problem (like usual) but if any one knows, it would be helpful. This is all that's done: sql = 'spName;'
9
5487
by: Ralph Cramden | last post by:
I'm writing a VB6 app which calls several stored procedures on my SQL Server DB. The first stored procedure must complete its inserts before the second stored procedure can query the modified table for its results. My problem is that the second stored procedure occasionally returns a different result set, acting as if the first stored procedure didn't complete (or didn't run).
3
2807
by: Rhino | last post by:
I've spent the last couple of hours trying to figure out how to debug a Java stored procedure and am just going in circles. The last straw came when I got "Cannot open input stream for default" when I launched the IBM Distributed Debugger via D:\IBMDebug>idebug.exe -qdaemon -quiport=8000,8001 First, a bit of background. I am running DB2 V7.2 with Fixpack 9 applied on Windows XP Professional (all critical service applied). I've written...
5
3487
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored Procedures. I thought stored pricedures were an Oracle/MS SQL Server thing and don't know how they work with Access Jet. I've looked at some of the help on stored procedures in A2003, but really don't understand what's going on. Can someone...
5
2255
by: Rob Wire | last post by:
For the code below, how could I add an item in the drop down lists for both company and location to be an "All" selection that would send to the stored proc. spRptAttachments a value of "%" so that it would bring back all attachments at all companies or all locations at a company? Thank you, Rob. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then
45
3415
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
1
6714
by: m.biddiscombe | last post by:
Hi, I'm trying to use pymssql to execute a stored procedure. Currently, I have an Excel spreadsheet that uses VBA in this manner: Private Function CreateNewParrot(connDb As ADODB.Connection) As Long Dim objCommand As ADODB.Command Dim iParrot As Long Dim bSuccess As Boolean
1
2995
by: James Su | last post by:
I tried to use pymssql to access MSSQL 2000, with a table, I store Chinese Character in NVarchar field, Chinese Character display normally when I query them by MS SQL Query Analyzer under Windows or by unixODBC under Ubuntu. But when I query those data by pymssql or pyodbc, all Chinese Character display ??? instead. Does anyone has some advice or thread? Thanks.
7
6690
by: ChaosKCW | last post by:
Hi I am trying to use pymssql, and have an issue where by the execute (not the fetch) is appearing to load all records into memory. if I execute con = pymssql.connect(...) cur = con.cursor() cur.execute(sql)
0
9671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10433
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10212
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10161
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.