RE: SQL Server stored prcedures with output parameters

From: Tim Golden (tim.golden_at_viacom-outdoor.co.uk)
Date: 11/18/04


To: 'Steve Holden' <steve@holdenweb.com>, python-list@python.org
Date: Thu, 18 Nov 2004 08:54:09 -0000


[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
________________________________________________________________________