The SQL I wanting to run is: select *, strIssConfigInfo_FD from DBA.IntegratedSalesSystems_TB where nIssIsActive_FD
= 1
I would like to run this once per SQL instance across databases on that SQL instance to get the results.
Ideally if I can include the database name that would be good too
EXEC sp_msforeachdb
'USE [?];
PRINT ''DBName='' + DB_Name()
IF EXISTS (SELECT * FROM sys.tables WHERE name = ''IntegratedSalesSystems_TB'')
BEGIN
SELECT [DBName] = DB_Name(),
*,
strIssConfigInfo_FD
FROM DBA.IntegratedSalesSystems_TB
WHERE nIssIsActive_FD = 1
END
'