Scripts

Create a view to Alter a Table and Add three Columns

I am teaching a database class at Queens College. The project entails the truncation of all of the data and loading new data into the  existing database "BIClass" from a single of the flattened data. One of the tasks of the project was to add these three additional columns to each of the tables (AlterTableAddColumnsUserAuthorizationKeyAndTwoTimeStamps): […]

4 (2)

2019-11-18 (first published: )

768 reads

Function and Queries to Convert Hierarchical Adjacency to Nested Json Arrays

This script converts hierarchical adjacency into nested json rows which contain the recursive "downlines" of each node.  The table-valued function treats each row in the original adjacency as the root node in a recursive common table expression. 

2019-11-12 (first published: )

640 reads

sp_PerfSQ

A diagnostic tool for identifying Performance features of active SQL Queries. It collects performance detail from DMVs for queries with executing requests and is designed to demonstrate and quantify Query Shaping optimisation techniques by: quantifying query workload and throughput characteristics providing behavioural descriptors of potential performance inhibitors - refer column ThrottlePotential The ThrottlePotential column is […]

5 (3)

2019-11-07

2,365 reads

Generic trigger for maintaining the Audit Log

This trigger will work even if you don't have the primary key on any table. Mechanism to configure the primary key in config table has been provided. This can be very helpful to solve the system audit requirements without much efforts.

Disclaimer : Audit Log trigger has performance overhead. It’s meant for table which is not frequently updated, deleted or inserted. Please take precaution when creating the trigger on the table having too many columns.

2.33 (3)

2019-10-15 (first published: )

747 reads

List Extended Database properties for all databases

I am using database properties to add some useful information for each database. Tired of exploring each database from the menu in SSMS to look for specific information, I decided to make a script listing the extended properties for all my databases. I am pleased to offer this to the community 🙂

2019-10-01 (first published: )

654 reads

Blogs

checkshark.com

By

Check Shark: A sharp name with a bankable premise and notable sound. ...

kushacres.com

By

Kush Acres: A lush name with huge growth potential in the cannabis space. ...

dartling.com

By

A cute name that riffs on 'dart' and 'darling' to aim your arrows true. ...

Read the latest Blogs

Forums

Updating Two Values from a Temp table

By smthembu

I have a source table from Oracle db that needs to Update a SQL...

Placing Data files on NAS

By tmmutsetse

Hi experts, Is it ok to run a Production DB with data files and...

SQL Server Backup and Restore Ebook error

By as1981

When I fill in the form here https://www.red-gate.com/library/sql-server-backup-and-restore?utm_source=ssc&utm_medium=publink&utm_campaign=books&utm_content=backup_and_restore_ebook&utm_term=backupandrestore and click 'download ebook' the button...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers