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.