Skip to Content.
Sympa Menu

freetds - RE: [freetds] Using sp_executesql with Microsoft SQL Server 2000

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Rogers, Tom" <tom.rogers AT ccur.com>
  • To: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Using sp_executesql with Microsoft SQL Server 2000
  • Date: Mon, 30 Jun 2003 18:27:04 -0400

I stand corrected...I tried it several times, but I kept getting it wrong,
and the books online for this are very poor.

I tried the following (like your example but with one less var):
declare @a smallint
exec sp_executesql N'select @a=2',
N'@a int output', @a
select @a

expecting it to work...but it did not.

Seems I needed YET ANOTHER "output" statement:

declare @a smallint
exec sp_executesql N'select @a=2',
N'@a int output', @a output
select @a

The above works as expected.

Thomas Rogers
System Engineer
Concurrent Computer Corporation
> phone: 215.712.7422 x7261


-----Original Message-----
From: Lowden, James K [mailto:LowdenJK AT bernstein.com]
Sent: Monday, June 30, 2003 4:56 PM
To: 'FreeTDS Development Group'
Subject: RE: [freetds] Using sp_executesql with Microsoft SQL Server
2000


> From: Rogers, Tom [mailto:tom.rogers AT ccur.com]
> Sent: June 30, 2003 12:36 PM
>
> However, to answer your specific question dealing with the use of
> sp_executesql for parameter passing, though I think on the
> surface it is a
> good idea for the reasons you state, just be aware that I
> don't think said system SP supports output parameters

Thomas,

sp_executesql returns output parameters:

1> declare @b smallint
exec sp_executesql N'select @a=1',
N'@a int output',
@a=@b output
select @b
2> go

------
1

(1 row affected)

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that we do not accept account orders and/or
instructions by e-mail, and therefore will not be responsible for carrying
out such orders and/or instructions.


_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page