Question
Redo the queries using SSRS. For every database/schema, list all table with audit table. USE BOOK; SELECT table_name = t.name, schema_name = s.name FROM sys.tables
Redo the queries using SSRS.
- For every database/schema, list all table with audit table.
USE BOOK;
SELECT table_name = t.name, schema_name = s.name
FROM sys.tables t
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
WHERE t.name LIKE '%audit%';
USE COMPANY;
SELECT table_name = t.name, schema_name = s.name
FROM sys.tables t
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
WHERE t.name LIKE '%audit%';
USE DGDB;
SELECT table_name = t.name, schema_name = s.name
FROM sys.tables t
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
WHERE t.name LIKE '%audit%';
USE OES2;
SELECT table_name = t.name, schema_name = s.name
FROM sys.tables t
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
WHERE t.name LIKE '%audit%';
USE PROP;
SELECT table_name = t.name, schema_name = s.name
FROM sys.tables t
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
WHERE t.name LIKE '%audit%';
USE SP;
SELECT table_name = t.name, schema_name = s.name
FROM sys.tables t
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
WHERE t.name LIKE '%audit%';
USE ZEOTA;
SELECT table_name = t.name, schema_name = s.name
FROM sys.tables t
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
WHERE t.name LIKE '%audit%';
2. For every database/schema, list schema, users, role, dept
SELECT schema_name = name
FROM sys.schemas;
SELECT user_name = name
FROM sys.database_principals
WHERE type_desc = 'SQL_USER';
SELECT role_name = name
FROM sys.database_principals
WHERE type_desc = 'DATABASE_ROLE';
SELECT department_name = name
FROM sys.schemas;
3. For every database/schema, list schema equipped with triggers to manage change in users.
SELECT DISTINCT OBJECT_SCHEMA_NAME(parent_id) AS schema_name
FROM sys.triggers
WHERE OBJECT_NAME(parent_id) LIKE '%user%';
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started