Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Declaring an output value

Author  Topic 

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-12-22 : 17:12:56
Hello,
when passing parameters to my SP, i can easily use the output value.

However how do i declare an output value, i want to use in my SP ?

my error is in red below, how do i assign a value to a runtime variable, for output ?

thanks



create procedure [dbo].[sql_test] (@csv as Varchar(8000) output)
AS


declare @check varchar(100) output

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-12-22 : 18:48:24
Declare it as normal, and specify output in the stored proc call

declare @check varchar(100)
set @check = 'test input'
exec dbo.sql_test @check output
select @check
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-12-23 : 00:22:42
Ok quite simple, Just that am calling it from an webpage,
thank you
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-12-23 : 11:41:02
In that case you need to create a parameter on your ADO or ADO.NET command object and set the type of the parameter to output. Also make sure you set the type of the command to stored procedure.
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-12-23 : 16:40:01
I am using ADO



set cmdSms = Server.CreateObject("ADODB.Command")
cmdSms.ActiveConnection = hello
cmdSms.CommandText = "S_Billing_web3_beta"
cmdSms.CommandType = 4
cmdSms.CommandTimeout = 0
cmdSms.Prepared = true
cmdSms.Parameters.Append cmdSms.CreateParameter("@RETURN_VALUE", 3, 4)
cmdSms.Parameters.Append cmdSms.CreateParameter("@csv", 200, 1,8000, receipients)
CmdSms.Execute()



Am using @RETURN_VALUE and its returning an error being of integer value and i want to read a varchar value
Go to Top of Page
   

- Advertisement -