Passing string as parameter to stored procedures

  • Hi

    I am writing stored procedures in sql 2005 server. I want to pass string as parameter to retrieve the details. just like using 'LIKE' keyword in sql. I could pass integer.

    When I'm trying execute this its bland details are displayed. I'm executing directly db(not calling from application)

    Eg:

    Create SP_Emp

    @name varchar(50)

    Begin

    Select FName,LName FROM EmpDetails

    Where FName like '%ve%'

    End

  • Hello,

    If I understand your question correctly, you just need to include the parameter in your Where clause e.g.

    Where FName Like '%' + @name + '%'

    Regards,

    John Marsh

    www.sql.lu
    SQL Server Luxembourg User Group

Viewing 2 posts - 1 through 1 (of 1 total)

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