Skip to content

Commit ab3f7b7

Browse files
author
Kevin Martin
committed
added skip checks functionality
1 parent c3fc9d6 commit ab3f7b7

File tree

2 files changed

+488
-473
lines changed

2 files changed

+488
-473
lines changed

README.md

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ EXECUTE dbo.sp_Develop
2525
|--|--|
2626
|@DatabaseName|Defaults to current DB if not specified|
2727
|@GetAllDatabases|Runs checks across all of the databases on the server instead of just your current database context. Does not work on Azure SQL Server.|
28-
|@IgnoreCheckIds|Comma-delimited list of check ids you want to skip|
29-
|@IgnoreDatabases|Comma-delimited list of databases you want to skip|
28+
|@SkipChecksServer|The linked server name that stores the skip checks|
29+
|@SkipChecksDatabase|The database that stores the skip checks|
30+
|@SkipChecksSchema|The schema for the skip check table|
31+
|@SkipChecksTable|The table that stores the skip checks|
3032
|@BringThePain |If you’ve got more than 50 databases on the server, this only works if you also pass in @BringThePain = 1, because it’s gonna be slow.|
3133
|@OutputType|TABLE = table<br/>COUNT = row with number found<br/>MARKDOWN = bulleted list<br/>XML = table output as XML<br/>NONE = none|
3234
|@OutputXMLasNVARCHAR|Set to 1 if you like your XML out as NVARCHAR.|
@@ -37,9 +39,65 @@ EXECUTE dbo.sp_Develop
3739

3840
## How to Skip Checks Across Your Estate
3941

40-
Sometimes there are checks, databases or servers that you want to skip. For example, say a database is from a vendor and you are not responsible for the database development. Another use case for skipping checks is indicate that you have acknowledged a potential issue and you are OK with it. You can skip that check for that specific object.
42+
Sometimes there are checks, databases or servers that you want to skip. For example, say a database is from a vendor and you are not responsible for the database development.
4143

42-
To do that, create a table to hold the list of checks you want to skip, and put rows into it:
44+
Another use case for skipping checks is to indicate that you have acknowledged a potential issue and you are OK with it. You can skip that check for that specific object. Using sp_Develop with this pattern allows you to perform your database development and iteratively check for issues.
45+
46+
#### Create a table to hold the list of checks you want to skip
47+
48+
```sql
49+
CREATE TABLE dbo.DevelopChecksToSkip (
50+
DevelopChecksToSkipId INT IDENTITY(1, 1) NOT NULL
51+
,ServerName NVARCHAR(128) NULL
52+
,DatabaseName NVARCHAR(128) NULL
53+
,SchemaName NVARCHAR(128) NULL
54+
,ObjectName NVARCHAR(128) NULL
55+
,CheckId INT NULL
56+
,CONSTRAINT DevelopChecksToSkip_DevelopChecksToSkipId PRIMARY KEY CLUSTERED (DevelopChecksToSkipId ASC)
57+
);
58+
GO
59+
```
60+
61+
#### Checks to Skip
62+
63+
The CheckId column refers to the list below. You can also scroll to the right in the sp_Develop 'Results' tab and look at the 'CheckId' column to see the number of the one you want to skip.
64+
65+
You can also copy the TSQL script in the 'SkipCheckTSQL' column found in the 'Results' tab to insert that record into your skip checks table.
66+
67+
Refer to the example checks below and each comment for its use.
68+
69+
```sql
70+
INSERT INTO
71+
dbo.DevelopChecksToSkip (ServerName, DatabaseName, SchemaName, ObjectName, CheckId)
72+
VALUES
73+
(N'SQL2008', NULL, NULL, NULL, NULL) /* Skips all checks, for every database, on the SQL2008 SQL Server */
74+
,(N'SQL2012', N'AdventureWorks2012', NULL, NULL, NULL) /* Skips all checks, in the AdventureWorks2012 database, on the SQL2012 SQL Server */
75+
,(N'SQL2017', N'AdventureWorks2017', N'dbo', N'fn_TPSTotal', NULL)/* Skips all checks, for the object named dbo.fn_TPSTotal, in the AdventureWorks2017 database, on the SQL2017 SQL Server */
76+
,(N'SQL2019', N'Northwind', N'dbo', N'Order Details', 5) /* Skips CheckId 5 (Including Special Characters in Name), for the object named dbo.[Order Details], in the Northwind database, on the SQL2019 SQL Server*/
77+
,(NULL, N'AdventureWorks2017', NULL, NULL, NULL) /* Skips all checks, in the AdventureWorks2017 database, on every SQL Server */
78+
,(NULL, NULL, N'dbo', N'vPhone', NULL) /* Skips all checks, for the object named dbo.vPhone, in every database, on every SQL Server */
79+
,(NULL, NULL, N'dbo', N'CustOrderHist', 19); /* Skips CheckId 19 (Not Using SET NOCOUNT ON in Stored Procedure or Trigger), for the object named dbo.CustOrderHist, in every database, on every SQL Server */
80+
GO
81+
```
82+
83+
#### How to Execute the Skip Checks
84+
85+
```sql
86+
EXEC dbo.sp_Develop
87+
,@SkipCheckDatabase = N'pubs'
88+
,@SkipCheckSchema = N'dbo'
89+
,@SkipCheckTable = N'DevelopCheckToSkip';
90+
```
91+
92+
You can also centralize this skip checks table by putting it in a central location, setting up a linked server pointing to your central location, and then using the @SkipChecksServer parameter:
93+
94+
```sql
95+
EXEC dbo.sp_Develop
96+
@SkipCheckServer = N'ManagementServerName'
97+
,@SkipCheckDatabase = N'pubs'
98+
,@SkipCheckSchema = N'dbo'
99+
,@SkipCheckTable = N'DevelopCheckToSkip';
100+
```
43101

44102

45103
# Test Database Install

0 commit comments

Comments
 (0)