Passing table names to Stored Procedures.

  • Hello again,

    The questions keep coming

    Is there anyway to pass the name of a table into a stored procedure?

    The reason is this. I am implementing Search functionality in my program. I could make a different stored procedure for a search on each field. However, it would be easier if I could create one and have the program pass which fields to search.

    So you'd have a SP called usp_search_customers, that could handle all customer searching.

    For example, the program would let it know it wants to search in "residential_customers" where "LastName" begins with "S". But I don't want to harcode the table name or field, so they can be passed.

    I'm not sure if this is possible, but I'd prefer it to making a different SP for each table and field.

    Thanks.

  • I don't have time to answer your question in detail... but this should do the trick .

    http://www.sommarskog.se/dyn-search.html

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

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