Scripts

Technical Article

Amazon RDS SQL Server - Drop Database with Mirroring

Dropping database in RDS follows different method than dropping the database in local SQL Server. Below is the command to DROP the database in Amazon RDS EXECUTE msdb.dbo.rds_drop_database N'demodb' GO However when the SQL Server is configured with Multi-zone mirroring, then you need to set the partner to OFF and drop all active connections and […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(1)

You rated this post out of 5. Change rating

2020-01-17

3,863 reads

Technical Article

T-SQL script to purge all the tables including foreign key references

T-SQL script to purge all the tables including foreign key references. The script has been made smart enough to use TRUNCATE wherever there is no foreign key reference and to use DELETE wherever there is foreign key reference.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(3)

You rated this post out of 5. Change rating

2019-12-10

2,656 reads

Technical Article

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. 

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2019-11-24

939 reads

Technical Article

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): […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(3)

You rated this post out of 5. Change rating

2019-11-18 (first published: )

1,040 reads

Technical Article

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. 

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2019-11-12 (first published: )

2,159 reads

Technical Article

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 […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(3)

You rated this post out of 5. Change rating

2019-11-07

4,223 reads

Blogs

Car Update September 2026

By

Software is hard. While I love our Lucid Gravity, I realize that they are...

Microsoft Tools for Making Data AI-Ready

By

Making Data AI-Ready, Part 2 (This is the second article in a three-part series...

Local Models Using GPUs with Ollama

By

Can you use your GPUs when running a local model under Ollama? You can,...

Read the latest Blogs

Forums

Moving Beyond the Reboot: Finding the Culprit Behind Memory Pressure

By Pablo Echeverria

Comments posted to this topic are about the item Moving Beyond the Reboot: Finding...

Reserved Words I

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Reserved Words I

Get Along

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Get Along

Visit the forum

Question of the Day

Reserved Words I

Which of these are not reserved words?

See possible answers