Hi,
I'm new to SQL 2005.
I need to create sp that perform search on Users table.
It gets few Parameters.
@.UserName
@.UserStatus
@.UserRole
@.OrderByColumn
All Parameters are optional, and i need to build sql statement that include only the parameters that the sp got on the specific.
I cand do that by concatanating a string and execute it using the sp_executesql().
Is it the best way in sql 2005 ?
Can you please show me an example using Case When or what ever ?
Thanks A lot.
Tok
A very good article on dynamic search that contains more than examples at:
http://www.sommarskog.se/dyn-search.html.
Please check it out.
No comments:
Post a Comment