I want to combine the output of this query in one table, what should i use join/union or something else?
DECLARE @name VARCHAR(1000)
DECLARE db_cursor CURSOR FOR
SELECT name FROM MASTER.dbo.sysdatabases
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @name
WHILE @@FETCH_STATUS = 0
BEGIN
select getdate() as [Date Time], DEFAULT_DOMAIN()[Domain], SERVERPROPERTY('MachineName') AS Server,@@servername as [Instance],@name AS [Database], *
from sys.sysprocesses
FETCH NEXT FROM db_cursor INTO @name
END
CLOSE db_cursor
DEALLOCATE db_cursor
More Stories
The difference in application of Data Science based on industry
Best agency for Mobile App Development in Dallas — nominal pricing and quality experience promised
Legacy Systems Reimagined: Modernizing Software with Low-Code Development