sql server - SQL - How can I use a Select based on the parameter -
i've got sql statement in sql server stored procedure using clause this:
select (fields) table testname @searchletter + '%'
i need check parameter @searchletter
, if it's "#", need make parameter choose records field testname
starts numeric field (0-9)
i've tried several things (ifs/selects, etc.) can't seem need.
anyone know how can this?
try
where testname case @searchletter when '#' '[0-9]' + '%' else @searchletter + '%' end
Comments
Post a Comment