problems with return parameter of store procedure

  • Dear all,

            I have a probelm with a return sqlparameter. I am developing with C#.Net and ADO.Net.  I use MS SQL 2000 sp3. now I get a reutrn value of sql parameter is int even though the parameter variable of store procedure is smallint. SQL store procedure can't return smallint?

    Pls help me  as soon as possible..

     

    Thank a lot.

     

     

  • Can you give snippets of your C# and T-SQL stored procedure? Make sure that you clean up any code to hide anything that might be sensitive your organization. That would help us figure out what's going on.

    K. Brian Kelley
    @kbriankelley

  • You need to look at your C# parameter set up. It was confused while I used that.

  • The return value of a stored proc is always an int.  If you use a smaller type, like tinyint or smallint, it will be converted. If you try to return something like a varchar, it will return an error.

    You can use an OUTPUT parameter to return a different type.

    Dylan Peters
    SQL Server DBA

  • You might consider using a user defined function rather than a stored procedure.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply