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 |
|
pradeepmanne
Starting Member
31 Posts |
Posted - 2011-11-24 : 10:12:01
|
| hi all,my storeprocedure will convert datatype into binaryi want the return value which is in binary form to be used in my front end application any solutionALTER proc [dbo].[ConvertCharToBinary](@Value varchar(8000))asBegin declare @return binary select @return=(cast(CAST(@Value as char(8000)) as binary(8000))) return(@return)Endthanks inadvance |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-11-24 : 10:46:21
|
Stored procedures return datatype INT. If you want to get back binary, use an output parameter rather than the return value - for example:create proc [dbo].[ConvertCharToBinary](@Value varchar(8000), @returnValue BINARY(8000) OUTPUT)asBeginSET @returnValue = CAST(@Value AS BINARY(8000));End In your .net code, you should define the @returnValue parameter with ParameterDirection = Output or ParameterDirection = InputOutput, of type SqlDbType.Binary or SqlDbType.VarBinary.Unless you want the binary |
 |
|
|
|
|
|