I have a procedure that has this Update statement[quote]@TableName varchar(128) ,@SourceCount intif @TableName = 'AcctStatus' BEGIN update dbo.MonitorDetail set NoOfRowsLoaded = isnull((select count(1) from document.Status with (nolock)), 0), NoOfRowsExpected = @SourceCount, LoadEndDate = @CurrDate from dbo.MonitorDetail md with (nolock) where LoadNo = @LoadNo and tablename = @TableName END[/quote]I don't want to hardcode the table name, so I have another Table called ListedTables [quote]CREATE TABLE [daily].[ListedTables]( [LoadNo] [int] NOT NULL, [TableName] [varchar](128) NOT NULL)[/quote], which list all the table names.I want to use this ListedTables table to look up the table name instead of hardcoding the table, but I'm not sure about the logic, how to use it in the Update Statement above.
↧