all groups > sql server programming > january 2006 >
You're in the

sql server programming

group:

pass a value other than a recordset from a stored proc


pass a value other than a recordset from a stored proc Marcel
1/24/2006 10:41:02 PM
sql server programming:
Ok I need to pass a value bask the my program that isnt the result of a query
"but is the outcome of a query"
for instance:


if exists (SELECT email, phone
FROM users
WHERE (email = N'jim@jones.com')
or (phone= N'1234567'))
return the vale true
else
return the value false


thanks

marcel
Re: pass a value other than a recordset from a stored proc Jens
1/24/2006 11:37:47 PM
You can either use Output variables or return values? The usage of
these depend on your programming language:

That=B4ll be in C#:

SqlParameter param =3D cmd.Parameters.Add("@SomeOutputParam",
SqlDbType.Int);
param.Direction =3D ParameterDirection.Output;
param =3D cmd.Parameters.Add("@SomeOutputParam", SqlDbType.VarChar);

For the return value that=B4ll be:

SqlParameter returnValue =3D
sqlCommand.Parameters.Add("@ReturnValue",SqlDbType.Int);
returnValue.Direction =3D ParameterDirection.ReturnValue;
return (Int32)returnValue.Value;


HTH, Jens Suessmeyer.
Re: pass a value other than a recordset from a stored proc Uri Dimant
1/25/2006 12:00:00 AM
[quoted text, click to view]


if exists (SELECT email, phone FROM users WHERE (email =
N'jim@jones.com') or (phone= N'1234567'))
return 1
else
return -1







[quoted text, click to view]

AddThis Social Bookmark Button