Recently, my job need to design a generic application to query a lot of same format table within the sql server, in order to enhance the efficiency, I try to use procedure, however I dont know how to dynamic to input the table name parameter into the procedure. Have anyone can help me to solve it!
the following procedure code cant work, have any good idea to solve:
the following procedure code cant work, have any good idea to solve:
Code:
CREATE PROCEDURE TOTAL_TOPX_HANDLE AS SELECT COUNT(*) AS TOTAL FROM [COLOR=Sienna]**Table_name** [/COLOR] WHERE (PROFILE_STATUS <> A) AND (DAY(START_TIME) = DAY(GETDATE())) AND (MONTH(START_TIME) = MONTH(GETDATE())) AND (YEAR(START_TIME) = YEAR(GETDATE()))
Last edited by a moderator: