This is an old revision of the document!


SQL Server

Solutions

Example Queries

Get Config Settings

SELECT *
FROM sys.configurations

Select Into Variable

USE master;
GO
 
DECLARE @TblTmp TABLE ([name] nvarchar(100), is_disabled bit)
 
INSERT INTO @TblTmp ([name], is_disabled)
SELECT [name], is_disabled
FROM sys.sql_logins
WHERE principal_id = 1
 
SELECT * FROM @TblTmp
USE [master]
GO
 
DECLARE @IsFinding bit
SET @IsFinding = 0
 
IF EXISTS (SELECT [name]
FROM sys.databases
WHERE [name] IN ('pubs', 'Northwind', 'AdventureWorks', 'WorldwideImporters'))
SET @IsFinding = 1
 
 
IF @IsFinding = 1
SELECT @@SERVERNAME AS [Server Name], 'Finding' AS STATUS, 'STIG V-213954' AS reference
ELSE
SELECT @@SERVERNAME AS [Server Name], 'Pass' AS STATUS, 'STIG V-213954' AS reference
  • qnd/sql_server.1640796883.txt.gz
  • Last modified: 2021/12/29 16:54
  • by mgupton