Skip to content

Commit 99fa6a9

Browse files
authored
Merge pull request #117 from LowlyDBA/development
Version 1.0
2 parents cd2f7b1 + 6efbe4c commit 99fa6a9

File tree

11 files changed

+251
-187
lines changed

11 files changed

+251
-187
lines changed

.github/codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ coverage:
22
range: 70..100
33
round: down
44
precision: 2
5+
status:
6+
patch: off
57

68
fixes:
79
- "::"

appveyor/appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 0.9.{build}
1+
version: 1.0.{build}
22

33
pull_requests:
44
do_not_increment_build_number: false
@@ -124,4 +124,4 @@ for:
124124

125125
# Upload code coverage report, push generated files
126126
#on_success:
127-
# - codecov -f %COV_REPORT%
127+
# - codecov -f %COV_REPORT%

appveyor/sqlcover/Coverage.opencoverxml

Lines changed: 111 additions & 111 deletions
Large diffs are not rendered by default.

appveyor/sqlcover/[dbo].[sp_doc]

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
CREATE PROCEDURE [dbo].[sp_doc]
3-
@DatabaseName SYSNAME = NULL
4-
,@ExtendedPropertyName VARCHAR(100) = 'Description'
3+
@DatabaseName SYSNAME = NULL
4+
,@ExtendedPropertyName SYSNAME = 'Description'
55
/* Parameters defined here for testing only */
66
,@SqlMajorVersion TINYINT = 0
77
,@SqlMinorVersion SMALLINT = 0

appveyor/sqlcover/[dbo].[sp_helpme]

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
CREATE PROCEDURE [dbo].[sp_helpme]
3-
@objname SYSNAME = NULL
4-
,@epname SYSNAME = 'Description'
3+
@ObjectName SYSNAME = NULL
4+
,@ExtendedPropertyName SYSNAME = 'Description'
55
/* Parameters defined here for testing only */
66
,@SqlMajorVersion TINYINT = 0
77
,@SqlMinorVersion SMALLINT = 0
@@ -84,8 +84,8 @@ BEGIN
8484
SET @HasMasked = 1;
8585
END;
8686

87-
-- If no @objname given, give a little info about all objects.
88-
IF (@objname IS NULL)
87+
-- If no @ObjectName given, give a little info about all objects.
88+
IF (@ObjectName IS NULL)
8989
BEGIN;
9090
SET @SQLString = N'SELECT
9191
[Name] = [o].[name],
@@ -96,15 +96,15 @@ BEGIN
9696
[ExtendedProperty] = [ep].[value]
9797
FROM [sys].[all_objects] [o]
9898
LEFT JOIN [sys].[extended_properties] [ep] ON [ep].[major_id] = [o].[object_id]
99-
and [ep].[name] = @epname
99+
and [ep].[name] = @ExtendedPropertyName
100100
AND [ep].[minor_id] = 0
101101
AND [ep].[class] = 1
102102
ORDER BY [Owner] ASC, [Object_type] DESC, [name] ASC;';
103-
SET @ParmDefinition = N'@epname SYSNAME';
103+
SET @ParmDefinition = N'@ExtendedPropertyName SYSNAME';
104104

105105
EXEC sp_executesql @SQLString
106106
,@ParmDefinition
107-
,@epname;
107+
,@ExtendedPropertyName;
108108

109109
-- Display all user types
110110
SET @SQLString = N'SELECT
@@ -131,49 +131,49 @@ BEGIN
131131
RETURN(0);
132132
END -- End all Sysobjects
133133

134-
-- Make sure the @objname is local to the current database.
135-
SELECT @ObjShortName = PARSENAME(@objname,1);
136-
SELECT @DbName = PARSENAME(@objname,3);
134+
-- Make sure the @ObjectName is local to the current database.
135+
SELECT @ObjShortName = PARSENAME(@ObjectName,1);
136+
SELECT @DbName = PARSENAME(@ObjectName,3);
137137
IF @DbName IS NULL
138138
SELECT @DbName = DB_NAME();
139139
ELSE IF @DbName <> DB_NAME()
140140
BEGIN
141141
RAISERROR(15250,-1,-1);
142142
END
143143

144-
-- @objname must be either sysobjects or systypes: first look in sysobjects
144+
-- @ObjectName must be either sysobjects or systypes: first look in sysobjects
145145
SET @SQLString = N'SELECT @ObjID = object_id
146146
, @SysObj_Type = type
147147
FROM sys.all_objects
148-
WHERE object_id = OBJECT_ID(@objname);';
149-
SET @ParmDefinition = N'@objname SYSNAME
148+
WHERE object_id = OBJECT_ID(@ObjectName);';
149+
SET @ParmDefinition = N'@ObjectName SYSNAME
150150
,@ObjID INT OUTPUT
151151
,@SysObj_Type VARCHAR(5) OUTPUT';
152152

153153
EXEC sp_executesql @SQLString
154154
,@ParmDefinition
155-
,@objName
155+
,@ObjectName
156156
,@ObjID OUTPUT
157157
,@SysObj_Type OUTPUT;
158158

159-
-- If @objname not in sysobjects, try systypes
159+
-- If @ObjectName not in sysobjects, try systypes
160160
IF @ObjID IS NULL
161161
BEGIN
162162
SET @SQLSTring = N'SELECT @ObjID = user_type_id
163163
FROM sys.types
164-
WHERE name = PARSENAME(@objname,1);';
165-
SET @ParmDefinition = N'@objname SYSNAME
164+
WHERE name = PARSENAME(@ObjectName,1);';
165+
SET @ParmDefinition = N'@ObjectName SYSNAME
166166
,@ObjID INT OUTPUT';
167167

168168
EXEC sp_executesql @SQLString
169169
,@ParmDefinition
170-
,@objName
170+
,@ObjectName
171171
,@ObjID OUTPUT;
172172

173173
-- If not in systypes, return
174174
IF @ObjID IS NULL
175175
BEGIN
176-
RAISERROR(15009,-1,-1,@objname,@DbName);
176+
RAISERROR(15009,-1,-1,@ObjectName,@DbName);
177177
END
178178

179179
-- Data Type help (prec/scale only valid for numerics)
@@ -190,19 +190,19 @@ BEGIN
190190
[ExtendedProperty] = ep.[value]
191191
FROM [sys].[types] AS [t]
192192
LEFT JOIN [sys].[extended_properties] AS [ep] ON [ep].[major_id] = [t].[user_type_id]
193-
AND [ep].[name] = @epname
193+
AND [ep].[name] = @ExtendedPropertyName
194194
AND [ep].[minor_id] = 0
195195
AND [ep].[class] = 6
196196
WHERE [user_type_id] = @ObjID';
197-
SET @ParmDefinition = N'@ObjID INT, @Yes VARCHAR(5), @No VARCHAR(5), @None VARCHAR(5), @epname SYSNAME';
197+
SET @ParmDefinition = N'@ObjID INT, @Yes VARCHAR(5), @No VARCHAR(5), @None VARCHAR(5), @ExtendedPropertyName SYSNAME';
198198

199199
EXECUTE sp_executesql @SQLString
200200
,@ParmDefinition
201201
,@ObjID
202202
,@Yes
203203
,@No
204204
,@None
205-
,@epname;
205+
,@ExtendedPropertyName;
206206

207207
RETURN(0);
208208
END --Systypes
@@ -217,17 +217,17 @@ BEGIN
217217
[ExtendedProperty] = [ep].[value]
218218
FROM [sys].[all_objects] [o]
219219
LEFT JOIN [sys].[extended_properties] [ep] ON [ep].[major_id] = [o].[object_id]
220-
AND [ep].[name] = @epname
220+
AND [ep].[name] = @ExtendedPropertyName
221221
AND [ep].[minor_id] = 0
222222
AND [ep].[class] = 1
223223
WHERE [o].[object_id] = @ObjID;';
224224

225-
SET @ParmDefinition = N'@ObjID INT, @epname SYSNAME';
225+
SET @ParmDefinition = N'@ObjID INT, @ExtendedPropertyName SYSNAME';
226226

227227
EXEC sp_executesql @SQLString
228228
,@ParmDefinition
229229
,@ObjID
230-
,@epname;
230+
,@ExtendedPropertyName;
231231

232232
-- Display column metadata if table / view
233233
SET @SQLString = N'
@@ -285,12 +285,12 @@ BEGIN
285285
INNER JOIN [sys].[types] AS [typ] ON [typ].[system_type_id] = [ac].[system_type_id]
286286
LEFT JOIN sys.extended_properties ep ON ep.minor_id = ac.column_id
287287
AND ep.major_id = ac.[object_id]
288-
AND ep.[name] = @epname
288+
AND ep.[name] = @ExtendedPropertyName
289289
AND ep.class = 1
290290
WHERE [object_id] = @ObjID
291291
END';
292-
SET @ParmDefinition = N'@ObjID INT, @epname SYSNAME';
293-
EXEC sp_executesql @SQLString, @ParmDefinition, @ObjID = @ObjID, @epname = @epname;
292+
SET @ParmDefinition = N'@ObjID INT, @ExtendedPropertyName SYSNAME';
293+
EXEC sp_executesql @SQLString, @ParmDefinition, @ObjID = @ObjID, @ExtendedPropertyName = @ExtendedPropertyName;
294294

295295
-- Identity & rowguid columns
296296
IF @SysObj_Type IN ('S ','U ','V ','TF')
@@ -310,13 +310,13 @@ BEGIN
310310
IF (@colname IS NOT NULL)
311311
SELECT
312312
'Identity' = @colname,
313-
'Seed' = IDENT_SEED(@objname),
314-
'Increment' = IDENT_INCR(@objname),
313+
'Seed' = IDENT_SEED(@ObjectName),
314+
'Increment' = IDENT_INCR(@ObjectName),
315315
'Not For Replication' = COLUMNPROPERTY(@ObjID, @colname, 'IsIDNotForRepl');
316316
ELSE
317317
BEGIN
318318
SET @Msg = 'No identity is defined on object %ls.';
319-
RAISERROR(@Msg, 10, 1, @objname) WITH NOWAIT;
319+
RAISERROR(@Msg, 10, 1, @ObjectName) WITH NOWAIT;
320320
END
321321

322322
-- Rowguid
@@ -336,7 +336,7 @@ BEGIN
336336
ELSE
337337
BEGIN
338338
SET @Msg = 'No rowguid is defined on object %ls.';
339-
RAISERROR(@Msg, 10, 1, @objname) WITH NOWAIT;
339+
RAISERROR(@Msg, 10, 1, @ObjectName) WITH NOWAIT;
340340
END
341341
END
342342

@@ -375,8 +375,8 @@ BEGIN
375375
IF @SysObj_Type IN ('S ','U ')
376376
BEGIN
377377
EXEC sys.sp_objectfilegroup @ObjID;
378-
EXEC sys.sp_helpindex @objname;
379-
EXEC sys.sp_helpconstraint @objname,'nomsg';
378+
EXEC sys.sp_helpindex @ObjectName;
379+
EXEC sys.sp_helpconstraint @ObjectName,'nomsg';
380380

381381
SET @SQLString = N'SELECT @HasDepen = COUNT(*)
382382
FROM sys.objects obj, sysdepends deps
@@ -393,7 +393,7 @@ BEGIN
393393

394394
IF @HasDepen = 0
395395
BEGIN
396-
RAISERROR(15647,-1,-1,@objname); -- No views with schemabinding for reference table '%ls'.
396+
RAISERROR(15647,-1,-1,@ObjectName); -- No views with schemabinding for reference table '%ls'.
397397
END
398398
ELSE
399399
BEGIN

docs/sp_doc.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![codecov](https://codecov.io/gh/LowlyDBA/ExpressSQL/branch/master/graph/badge.svg)](https://codecov.io/gh/LowlyDBA/ExpressSQL)
1010

1111
* [Purpose](#purpose)
12+
* [Arguments](#arguments)
1213
* [Usage](#usage)
1314
* [Sample](#sample)
1415
* [Contributing](#contributing)
@@ -47,6 +48,18 @@ and plays nice with:
4748
* Gitlab Flavored Markdown
4849
* Any other CommonMark based renderer
4950

51+
## Arguments
52+
53+
* `@DatabaseName SYSNAME`
54+
55+
Target database to generate documentation for.
56+
If not supplied, the current database is used.
57+
58+
* `@ExtendedPropertyName VARCHAR(100)`
59+
60+
Name of the extended property containing descriptive text for objects.
61+
The default value is "Description".
62+
5063
## Usage
5164

5265
The primary parameter for this procedure is a database name, since the

docs/sp_helpme.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![codecov](https://codecov.io/gh/LowlyDBA/ExpressSQL/branch/master/graph/badge.svg)](https://codecov.io/gh/LowlyDBA/ExpressSQL)
1010

1111
* [Purpose](#purpose)
12+
* [Arguments](#arguments)
1213
* [Usage](#usage)
1314
* [Contributing](#contributing)
1415
* [More](#more)
@@ -24,6 +25,18 @@ Changes from the original include:
2425
* Including create, modify, and more metadata about objects
2526
* Referenced views are returned in two-part naming convention
2627

28+
## Arguments
29+
30+
* `@ObjectName SYSNAME`
31+
32+
Target non-database object to show information for.
33+
If not supplied, information on all objects in the database is returned.
34+
35+
* `@ExtendedPropertyName SYSNAME`
36+
37+
Name of the extended property containing descriptive text for objects.
38+
The default value is "Description".
39+
2740
## Usage
2841

2942
Basic example:

docs/sp_sizeoptimiser.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![codecov](https://codecov.io/gh/LowlyDBA/ExpressSQL/branch/master/graph/badge.svg)](https://codecov.io/gh/LowlyDBA/ExpressSQL)
1010

1111
* [Purpose](#purpose)
12+
* [Arguments](#arguments)
1213
* [Usage](#usage)
1314
* [Checks](#checks)
1415
* [Contributing](#contributing)
@@ -23,6 +24,41 @@ useful for SQL Server Express to help stay under the 10GB file size limitations.
2324

2425
Storage is cheap, but smaller is faster!
2526

27+
## Arguments
28+
29+
* `@IndexNumThreshold SMALLINT`
30+
31+
Number of indexes to classify a table as having too many indexes on it.
32+
Default value is 10.
33+
34+
* `@IncludeDatabases [dbo].[SizeOptimiserTableType]`
35+
36+
Which databases to run the script on in the form of a user defined table type.
37+
If not supplied, all accessible user databases are targeted.
38+
Cannot be used in conjunction with `@ExcludeDatabases`.
39+
40+
* `@ExcludeDatabases [dbo].[SizeOptimiserTableType]`
41+
42+
Which databases to exclude in the form of a user defined table type.
43+
Cannot be used in conjunction with `@IncludeDatabases`.
44+
45+
* `@IncludeSysDatabases BIT`
46+
47+
Whether or not to include system databases in the script's analysis.
48+
Default is 0.
49+
50+
* `@IncludeSSRSDatabases BIT`
51+
52+
Whether or not to include SQL Server Reporting Services databases in
53+
the script's analysis.
54+
Default is 0.
55+
56+
* `@Verbose BIT`
57+
58+
Whether or not to print additional information during the script run,
59+
including which checks may be skipped and variable values.
60+
Default is 0.
61+
2662
## Usage
2763

2864
Basic example:

install_expsql.sql

486 Bytes
Binary file not shown.

sp_doc.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ END
1111
GO
1212

1313
ALTER PROCEDURE [dbo].[sp_doc]
14-
@DatabaseName SYSNAME = NULL
15-
,@ExtendedPropertyName VARCHAR(100) = 'Description'
14+
@DatabaseName SYSNAME = NULL
15+
,@ExtendedPropertyName SYSNAME = 'Description'
1616
/* Parameters defined here for testing only */
1717
,@SqlMajorVersion TINYINT = 0
1818
,@SqlMinorVersion SMALLINT = 0

0 commit comments

Comments
 (0)