Skip to main content

Home  Design Book  DMV Book  Presentations  Code  Calendar  Contact  About   
Snippets > Downloadable Packages >  
On this page are some stuff I have created for my use or to demonstrate something for someone else that you might find useful, or not, the fact is
they are here! For downloads that went directly with a presentation I gave, go to the presentation page. For downloads that go with one of my books,
go to the design book page.
 
WARNING: Use these objects at your own risk. It is encumbent upon you to read the code and understand what is occurring. Please contact me at louis@drsql.org if you find issues that I might want to change for future users. 
 

 

Add-Ins - Objects meant to be installed in a database and used. Every package will include a schema create for the schema that I expect it to be created in.

 

  

WaitFor Sync

Creates objects that will help you when doing a demo or testing code by making it easy to syncronize the starting of multiple sessions at the exact same time.  It does this by saving the time that will be used in the WAITFOR statement in a table.  Will create a Utility schema and objects in that schema (obviously changeable by downloader.)  Examples of how to use are included in comments at the end of the installation script.

 

WaitforSync-Install.sql

Code to create a basic date dimension

Nothing fancy, just dates, day of the week, month names, etc.

 

SimpleDateDimensionCreateAndLoad.sql 

Code to create a time table (not date)
This will create a table that has a row for every minute in the day to join to a datetime type with minutes. Gives you the ability to do a join to group by the part of the day or hour, like am_pm, half hour of the hour, or day, etc.

 

timeTableCreateAndLoad.sql

Procedures to drop all types of objects in a database.

Used by me to drop objects in a database before changing the collation of a database to remove all constraints/procedures etc that had references to the columns I needed to change.

 

utility.drop_objects_procs.zip

Procedures to reset disabled and non-trusted check and foreign key constraints.

I primarily use this after ETL that skips constraints due to using bulk load. If this gives any errors in the printed output, you will need to fix the constraint.

 

utility.constraints$ResetEnableAndTrustedStatus.sql  

 

 

  

 

Queries - Will not install any modules in your database. Used to query metadata, performance, or some aspect of the system.

 

  

Column Metadata

A more clear version of column metadata that you can find in INFORMATION_SCHEMA,
started primarily to get the datatype declaration, plus the base datatype for alias types.

 

ColumnMetaDataQuery.sql  

Database File Sizing

Lists all of the files on the server and groups them by database. Includes the file type and file name as well

 

DatabaseFilesSizing.sql 

Database Filegroup SIzing

Limited to one database, groups files by filegroups, including the file type and filename as well

 

FilegroupFileSizing.sql 

Identity Table Queries

Queries to interrogate the structure of the tables in the database to see how identity columns are being used. Examples are looking for tables with an identity key as the only key, in the primary key with another column, tables without an identity key, and several other scenarios.

 

IdentityTableQueries.sql