I have a simple statement in a stored procedure but it will apply to many tables in DB. How can I use switch(Case) to this query in just one stored procedure?
ALTER PROCEDURE [dbo].[xxx]
(
@numberOfRecords integer = NULL output,
@tableName nvarchar(10)
)
//use CASE HERE?
SET @numberOfRecords = (SELECT Count(*) FROM
@tableName WHERE charged > 50);
PRINT @numberOfRecords
or I have to write each stored procedure for each table?
Thanks.
Go to the complete details ...