Procedure does not return select data

1

I created a simple procedure, it receives a parameter and should return the data according to this parameter:

CREATE PROCEDURE [dbo].[testeLike]
    -- Add the parameters for the stored procedure here
    @teste varchar(50)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    select * from teste
        where valor like '@teste%'
END

running proc:

didnotreturnanydata:

ButifIgettheselectcodeandthetesto,thedataisreturned:

select*fromtestewherevalorlike'tes%'

I can not understand what the problem is. In the parameter I already tried to pass with single quotation marks, but gave the same one.

    
asked by anonymous 23.05.2016 / 15:42

1 answer

1

I discovered the problem. It was time to pass the parameter on select, the correct one is as follows:

select * from Produto
        where nome like @teste+'%'
    
23.05.2016 / 16:03