SqlServer动态变换库名
declare @tname varchar(20),@num int
set @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 output
select @num
declare @tname varchar(20),@num int
set @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 output
select @num