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.
Author |
Topic |
salmonraju
Yak Posting Veteran
54 Posts |
Posted - 2006-10-31 : 00:47:49
|
i want to return a values to application program in.net when a stored procedure is called.how to declare a return variable with varchar datatype. i am have to declare it as output parameterplease modify this if u can create proc test @id, @dept,@sal as declare @message update tab1 set id=4 where id=@id if(@@rowcount=0) begin set @message='error in updating' return @message end if(@@rowcount=0) begin set @message='error in inserting' return @message endor i have to declare @message as output parameter.To return string am i have to set return type of stored procedure? if so where i have to set ///////////////////////////////////////////////////// |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-10-31 : 00:53:31
|
you have to use the OUTPUT parametercreate proc test@id int, @dept int, @sal int, @message varchar(100) OUTPUTasdeclare @messageupdate tab1 set id=4 where id=@idif(@@rowcount=0)begin set @message='error in updating' return @messageendif(@@rowcount=0)begin set @message='error in inserting' return @messageend KH |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-31 : 00:54:30
|
create proc test@id int, @dept varchar(50), @sal int, @message varchar(1000) OUTasdeclare @messageupdate tab1 set id=4 where id=@idif(@@rowcount=0)beginset @message='error in updating' return @messageendinsert tab1 values(id)if(@@rowcount=0)beginset @message='error in inserting' return @messageendcall with test x, x, x, @message outPeter LarssonHelsingborg, Sweden |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-31 : 00:55:44
|
Peter LarssonHelsingborg, Sweden |
 |
|
salmonraju
Yak Posting Veteran
54 Posts |
Posted - 2006-10-31 : 01:15:49
|
THANK U Mr.K H Tan Mr.Peter LarssonSalmon |
 |
|
|
|
|
|
|