Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
USE master
GO
DROP PROC sp_get_sqlserver_service_account
GO
CREATE PROC sp_get_sqlserver_service_account
AS
-- =============================================
-- Variables
-- =============================================
DECLARE @machinename nvarchar(128),
@instancename nvarchar(128),
@profile nvarchar(128),
@regkey nvarchar(256),
@regkey2 nvarchar(256),
@accnt nvarchar(128),
@accnt2 nvarchar(128)
IF NOT ((charindex(N'7.00', @@version, 0) > 0) OR (charindex(N'8.00', @@version, 0) >
0))
BEGIN
RAISERROR(N'sp_get_sqlserver_service_account only support SQL Server 7.0 and 2000', 16, 1)
WITH log, nowait
END
IF (charindex(N'7.00', @@version, 0) > 0)
BEGIN
SELECT @instancename = NULL
END
IF (charindex(N'8.00', @@version, 0) > 0)
BEGIN
SELECT @machinename = CONVERT(nvarchar(128), serverproperty('MachineName')),
@instancename = CONVERT(nvarchar(128), serverproperty('InstanceName'))
END
-- =============================================
-- Get account name running SQL Server
-- =============================================
IF (@instancename IS NULL)
BEGIN
SELECT @regkey = N'SYSTEM\CurrentControlSet\Services\MSSQLServer',
@regkey2 = N'SYSTEM\CurrentControlSet\Services\SQLSERVERAGENT'
END
ELSE
BEGIN
SELECT @regkey = N'SYSTEM\CurrentControlSet\Services\MSSQL$' + @instancename,
@regkey2 = N'SYSTEM\CurrentControlSet\Services\SQLAgent$' + @instancename
END
EXEC master.dbo.xp_regread N'HKEY_LOCAL_MACHINE',
@regkey,
N'ObjectName',
@accnt OUTPUT,
N'no_output'
EXEC master.dbo.xp_regread N'HKEY_LOCAL_MACHINE',
@regkey2,
N'ObjectName',
@accnt2 OUTPUT,
N'no_output'
PRINT 'SQL Server is running under account ' + @accnt
PRINT 'SQL Server Agent is running under account ' + @accnt2
RETURN
GO
EXEC sp_get_sqlserver_service_account
declare @dm nvarchar(500)
exec master.dbo.xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', N'CachePrimaryDomain',@dm out
select @dm as Domainname