select name FROM MASTER.DBO.SYSDATABASES where left(name,7)='UFTData' ORDER BY NAME
OPEN My_Cursor
FETCH NEXT FROM My_Cursor INTO @Name
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC('insert into tempdb..Temp_ModuleList select '''+@name+ ''',sysid,InfoID,caption from ' + @Name + '..EAP_AccInformation where OptionType=1 and idEnablePeriod>0 order by infoid')
FETCH NEXT FROM My_Cursor INTO @Name
END
CLOSE My_Cursor
DEALLOCATE My_Cursor
select sysid,InfoID,caption 本服务器所有账套应用的模块 from tempdb..Temp_ModuleList group by sysid,InfoID,caption
select right(ztName,6) ztid,ztName,
count( case InfoID when 322 then caption end) 总账,
count( case InfoID when 323 then caption end) Tufo报表,
count( case InfoID when 319 then caption end) 固定资产,
count( case InfoID when 302 then caption end) 购销管理,
count( case InfoID when 301 then caption end) 库存核算,
count( case InfoID when 303 then caption end) 往来现金,
count( case InfoID when 304 then caption end) 自制加工
from tempdb..Temp_ModuleList group by right(ztName,6) ,ztName order by right(ztName,6)