3
Reply

how to remove single quotes from procedure variable

dimpal bhendarkar

dimpal bhendarkar

Mar 9 2015 5:43 AM
664

ALTER PROCEDURE LibAdvancedSearch
@ddl_one varchar(50)=null,
@param_one varchar(50)=null
AS
begin
SELECT * FROM AddBookDetailsLib
WHERE @ddl_one LIKE '%' + @param_one + '%'
end
RETURN

///////////

ex: query must be like "select * from AddBookDetailsLib where BookCategoty like 'history'"

so ddl_one should get BookCategory when i set from my business access layer.. but it get with single quote like 'BookCategory', so query will be like "select * from AddBookDetailsLib where 'BookCategoty' like 'history'"

i just wann remove single quote from @ddl_one so that it treat as column name

Answers (3)