declare @tname varchar(20),@num intset @tname='Players_Log_L10001'declare @sql Nvarchar(1000)=N'select @num=COUNT(*) from '+@tname+'.dbo.Log_Party_Join';Exec sp_executesql @sql,N'@num int output',@num outputselect @num