SQL Server stored prcedures with output parameters

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Nov 18 03:54:09 EST 2004


[Steve Holden]

| However, the stored procedure below appears to consistently 
| return zero for the link_id when called with:
| 
| columnist_id, url, title, description, link_id = \
| 	curs.callproc("sp_InsertArticle",
| 		(columnist_id, url, title, description, 0))
| 
| so maybe there really *is* something wrong.

Ummm... Well, I don't know how you'd do it from ado, but
if I were writing this in T-SQL, I'd be saying:

DECLARE @new_link_id
EXECUTE sp_InsertArticle @columnist_id... , @new_link_id OUTPUT

In other words, you have to tell SQL that the param you're
passing in is an output param. Frankly, I don't know why, since
the data dictionary already knows that the formal parameter to
which it corresponds is flagged as output, but there it is.
I don't know (and I don't have the time to look just at the 
moment) how ADO handles that.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list