A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Hi @vsslasd ,
Please refer below:
CREATE TABLE #ServicesStatus
(
Status varchar(50)
)
INSERT #ServicesStatus
EXEC xp_servicecontrol N'QUERYSTATE',N'WinService XYZ'
Declare @v varchar(max)
select @v=status from #ServicesStatus
select @v
OR:
declare @ServicesStatus table
(
Status varchar(50)
)
INSERT @ServicesStatus
EXEC xp_servicecontrol N'QUERYSTATE',N'WinService XYZ'
Declare @v varchar(max)
select @v=status from @ServicesStatus
select @v
Output:
Running.
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues November--What can I do if my transaction log is full?
Hot issues November--How to convert Profiler trace into a SQL Server table