happyIndian100
Programmer
Dear All,
i want to write a custom stored procedure to get the total records count by passing the table name to the stored procedure. Please help me to correct this stored procedure below...
CREATE procedure getrecordCount_SP
@TableName as varchar(30)
@TotalRecords as numeric output
as
begin
select @TableName = 'TableName'
declare @strSQL varchar(200)
select @strSQL = 'SELECT @TotalRecords = COUNT(*) FROM ' + @TableName
exec(@strSQL)
end
Thx in advance
i want to write a custom stored procedure to get the total records count by passing the table name to the stored procedure. Please help me to correct this stored procedure below...
CREATE procedure getrecordCount_SP
@TableName as varchar(30)
@TotalRecords as numeric output
as
begin
select @TableName = 'TableName'
declare @strSQL varchar(200)
select @strSQL = 'SELECT @TotalRecords = COUNT(*) FROM ' + @TableName
exec(@strSQL)
end
Thx in advance