Would it be possible to return the results of the following query into a table in SQL Server column wise.
exec master..xp_cmdshell 'Query User'
I have tried the following but this only returns one row with a string.
declare @tbl table (output NVARCHAR(100))
insert into @tbl (output)
exec master..xp_cmdshell 'Query User'
select *
from @tbl
where output is not null
I would like the output to be in different columns within the table instead of one. For Example:
USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
Any help would be appreciated.