Skip to content Skip to sidebar Skip to footer

Stored Procedure Does Not Return Anything

It is should be no problem to find but after long hours at my job I cannot notice what I'm doing wrong here. There is very simple stored procedure: ALTER PROCEDURE MyProc @input

Solution 1:

Change to @input char(10) to @input varchar(10)

your sp is currently running

isonum from iso where isonum like '%2333 %'

Solution 2:

ALTERPROCEDURE MyProc  
@inputvarchar(10)   --<-- Use varchar here ASBEGINSET NOCOUNT ON;
        SELECT isonum 
        FROM iso where isonum LIKE'%'+@input+'%'ORDERBY isonum
    END

'CHAR' or 'NCHAR' fixed data types and they add white spaces to the passed strings if it is less then the maximum length of the data.

Post a Comment for "Stored Procedure Does Not Return Anything"