I would like to assign the number of rows of my table to a variable.
DECLARE @ROW_COUNT nvarchar(1000);
SET @sql_row_count = 'SELECT COUNT(*) FROM ' + @TABLE_NAME;
EXEC sp_executesql @sql_row_count, @ROW_COUNT OUTPUT;
SET @ROW_COUNT = cast(@ROW_COUNT as int);
SELECT @ROW_COUNT;
@ROW_COUNT returns null.
Thank for help.