Skip to content

Commit 83dff67

Browse files
author
Kevin Martin
committed
Results documentation
1 parent 25350dc commit 83dff67

File tree

2 files changed

+35
-11
lines changed

2 files changed

+35
-11
lines changed

Images/sp_Develop_Results.png

29.6 KB
Loading

README.md

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,48 @@
11
# SQL Server Assess Overview
22
The SQL Server Assess project contains the [sp_Develop](https://github.com/EmergentSoftware/SQL-Server-Assess/blob/master/sp_Develop.sql) stored procedure. It can be used by database developers, software developers and for performing database code (smell) reviews.
33

4-
This lists the database development best practice checks and naming conventions checks for the stored procedure named sp_Develop.
4+
This lists the database development best practice checks and naming conventions checks for the stored procedure named [sp_Develop](https://github.com/EmergentSoftware/SQL-Server-Assess/blob/master/sp_Develop.sql).
55

66
## sp_Develop Install Instructions
77

88
It is recommend installing the [sp_Develop](https://github.com/EmergentSoftware/SQL-Server-Assess/blob/master/sp_Develop.sql) stored procedures in the master database for full SQL Servers, but if you want to use another one, that's totally fine.
99

10-
On Azure SQL Server you will need to install the sp_Develop stored procedure in the user database.
10+
On Azure SQL Server you will need to install the [sp_Develop](https://github.com/EmergentSoftware/SQL-Server-Assess/blob/master/sp_Develop.sql) stored procedure in the user database.
1111

1212
## sp_Develop Usage Instructions
1313

14-
After installing the [sp_Develop](https://github.com/EmergentSoftware/SQL-Server-Assess/blob/master/sp_Develop.sql) stored procedure open SSMS and run in the database you wish to check for database development best practices.
14+
After installing the [sp_Develop](https://github.com/EmergentSoftware/SQL-Server-Assess/blob/master/sp_Develop.sql) stored procedure open SQL Server Management Studio and run in the database you wish to check for database development best practices.
1515

1616
```sql
1717
EXEC dbo.sp_Develop
1818
```
1919

2020
[Check out the parameter section for more options](#Parameter-Explanations)
2121

22+
## sp_Develop Results
23+
24+
After running [sp_Develop](https://github.com/EmergentSoftware/SQL-Server-Assess/blob/master/sp_Develop.sql) the 'Results' tab will contain the checks findings.
25+
26+
![sp_Develop Results](Images/sp_Develop_Results.png)
27+
28+
The findings results are order by DatabaseName, SchemaName, ObjectName, ObjectType, FindingGroup, Finding. This allows you to review all the checks for an object at the same time.
29+
30+
#### Column Results Details
31+
32+
|Column Name|Details|
33+
|--|--|
34+
|DatabaseName|Can be run for multiple databases so this will show you the database with the potential issue|
35+
|SchemaName|This is the schema for the object that might have an issue|
36+
|ObjectName|This can be anything from user tables, views stored procedures, functions, …|
37+
|FindingGroup|The high level grouping for the check<br/> - Naming Conventions<br/>- Table Conventions<br/>- Data Type Conventions<br/>- SQL Code Development<br/>- Running Issues|
38+
|Finding|The specific potential issue we the check is looking for|
39+
|Details|Additional details about the potential issue. This does not go into in-depth details of the potential issue but should give you a heads up of what to look for.|
40+
|URL|Copy and paste this link into a browser to view the README.md write up for the potential issue|
41+
|SkipCheckTSQL|In this column you will find a generated TSQL script INSERT |
42+
|Priority|The lower the number the more severe the potential issue is to address|
43+
|CheckId|Every check is uniquely numbered|
44+
45+
2246
## sp_Develop Parameter Explanations
2347

2448
|Parameter|Details|
@@ -31,7 +55,7 @@ EXEC dbo.sp_Develop
3155
|@SkipChecksSchema|The schema for the skip check table, when you pass in a value the SkipCheckTSQL column will be used|
3256
|@SkipChecksTable|The table that stores the skip checks, when you pass in a value the SkipCheckTSQL column will be used|
3357
|@OutputType|TABLE = table<br/>COUNT = row with number found<br/>MARKDOWN = bulleted list<br/>XML = table output as XML<br/>NONE = none|
34-
|@Debug|Default 0. When 1, we print out messages of what we're doing in the messages tab of SSMS. When 2, we print out the dynamic SQL query of the check.|
58+
|@Debug|Default 0. When 1, we print out messages of what we're doing in the messages tab of SQL Server Management Studio. When 2, we print out the dynamic SQL query of the check.|
3559
|@Version|Output variable to check the version number.|
3660
|@VersionDate|Output variable to check the version date.|
3761
|@VersionCheckMode|Will set the version output variables and return without running the stored procedure.|
@@ -106,7 +130,7 @@ The 'Test Database' folder contains the RedGate SQL Source Control. Use this dat
106130
**Quick Steps to Setup and Use:**
107131

108132
1. Create new database 'spDevelop' and select in Object Browser
109-
2. Open RedGate SQL Source Control in SSMS
133+
2. Open RedGate SQL Source Control in SQL Server Management Studio
110134
3. Click 'Setup' tab
111135
4. Select 'Link to my source control system' and click 'Next'
112136
5. Browser to '..\Test Database' cloned folder and click 'Link'
@@ -115,7 +139,7 @@ The 'Test Database' folder contains the RedGate SQL Source Control. Use this dat
115139
8. Develop objects to use when you create a new check
116140
9. Click 'Commit' tab
117141
10. Select objects to be pulled back into the branch, add comment, click the 'Commit' button and click the 'Push' button
118-
11. **Note:** there are exclude fiters setup for invalid objects created in the post script. Do not check these objects back into the branch.
142+
11. **Note:** there are exclude filters setup for invalid objects created in the post script. Do not check these objects back into the branch.
119143

120144

121145
**RedGate SQL Source Control Documentation**
@@ -132,7 +156,7 @@ Included in this project are settings you can use for database development. Usin
132156
The settings are located in the project "[\SQL-Server-Assess\Development Application Settings\Microsoft\SQL Server Management Studio\General Settings](https://github.com/EmergentSoftware/SQL-Server-Assess/tree/master/Development%20Application%20Settings/Microsoft/SQL%20Server%20Management%20Studio/General%20Settings)"
133157

134158
1. Cloned or forked the repo
135-
2. In SSMS navigate to "Tools > Options > Environment > Import and Export Settings"
159+
2. In SQL Server Management Studio navigate to "Tools > Options > Environment > Import and Export Settings"
136160
3. Check "Use team settings file" and browse to "..\SQL-Server-Assess\Development Application Settings\Microsoft\SQL Server Management Studio\General Settings\SSMS.vssettings"
137161
4. Click the "OK" button
138162

@@ -263,9 +287,9 @@ Never use a descriptive prefix such as tbl_. This 'reverse-Hungarian' notation h
263287

264288
The use of the tbl_prefix for a table, often called "tibbling", came from databases imported from Access when SQL Server was first introduced. Unfortunately, this was an access convention inherited from Visual Basic, a loosely typed language.
265289

266-
SQL Server is a strongly typed language. There is never a doubt what type of object something is in SQL Server if you know its name, schema and database, because its type is there in sys.objects: Also it is obvious from the usage. Columns can be easily identified as such and character columns would have to be checked for length in the Object Browser anyway or Intellisense tooltip hover in SSMS.
290+
SQL Server is a strongly typed language. There is never a doubt what type of object something is in SQL Server if you know its name, schema and database, because its type is there in sys.objects: Also it is obvious from the usage. Columns can be easily identified as such and character columns would have to be checked for length in the Object Browser anyway or Intellisense tool-tip hover in SQL Server Management Studio.
267291

268-
Do not prefix your columns with "fld_", "col_", "f_", "u_" as it should be obvious in SQL statements which items are columns (before or after the FROM clause). Do not use a data type prefix for the column either, for example, "IntCustomerId" for a numeric type or "VcName" for a varchar type.
292+
Do not prefix your columns with "fld_", "col_", "f_", "u_" as it should be obvious in SQL statements which items are columns (before or after the FROM clause). Do not use a data type prefix for the column either, for example, "IntCustomerId" for a numeric type or "VcName" for a VARCHAR type.
269293

270294

271295

@@ -507,7 +531,7 @@ T-SQL code must execute properly and performant. It must be readable, well laid
507531

508532
Your scalar function is not inlineable. This means it will perform poorly.
509533

510-
Review the [Inlineable scalar UDFs requirements](https://docs.microsoft.com/en-us/sql/relational-databases/user-defined-functions/scalar-udf-inlining?view=sql-server-ver15#inlineable-scalar-udfs-requirements) to determine what changes you can make so it can go inline. If you cannot, you should inline your scalar function in SQL query. This means duplicate the code you would put in the scalar function in your SQL code. SQL Server 2019 & Azure SQL Database (150 database compatibility level) can inline some scalar functions.
534+
Review the [Inlineable scalar UDFs requirements](https://docs.microsoft.com/en-us/sql/relational-databases/user-defined-functions/scalar-udf-inlining?view=sql-server-ver15#inlineable-scalar-udfs-requirements) to determine what changes you can make so it can go inline. If you cannot, you should in-line your scalar function in SQL query. This means duplicate the code you would put in the scalar function in your SQL code. SQL Server 2019 & Azure SQL Database (150 database compatibility level) can inline some scalar functions.
511535

512536
Microsoft has been removing (instead of fixing) the inlineablity of scalar functions with every cumulative update. If your query requires scalar functions you should ensure they are being inlined. [Reference: Inlineable scalar UDFs requirements](https://docs.microsoft.com/en-us/sql/relational-databases/user-defined-functions/scalar-udf-inlining?view=sql-server-ver15#inlineable-scalar-udfs-requirements)
513537

@@ -802,7 +826,7 @@ Views do not lend themselves to being deeply nested. Views that reference views
802826
## Invalid Objects
803827
**Check Id:** [NONE YET]
804828

805-
This check found objects that were deleted, renamed. Use can also run "Find Invalid Objects" with RedGate SQL Prompt in SSMS.
829+
This check found objects that were deleted, renamed. Use can also run "Find Invalid Objects" with RedGate SQL Prompt in SQL Server Management Studio.
806830

807831
Try running EXEC sp_refreshsqlmodule or sp_refreshview.
808832

0 commit comments

Comments
 (0)