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

5 (1)

You rated this post out of 5. Change rating

2020-01-17

3,181 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.

5 (3)

You rated this post out of 5. Change rating

2019-12-10

2,421 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-25 (first published: )

703 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 (3)

You rated this post out of 5. Change rating

2019-11-18 (first published: )

977 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: )

1,946 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 […]

5 (3)

You rated this post out of 5. Change rating

2019-11-07

4,004 reads

Blogs

Query deadlock info in Azure SQL DB

By

A couple of weeks ago, a developer came to me and wanted to know...

MSSQL Database Property LastGoodCheckDbTime to Get the Last Successful DBCC CHECKDB on a Database

By

Database Property LastGoodCheckDbTime to Get the Last Successful DBCC CHECKDB on a Database As one...

Dynamic Warehouse & Lakehouse Connections in Microsoft Fabric Data Pipelines

By

When you develop data pipelines in Microsoft Fabric (the Azure Data Factory equivalent in...

Read the latest Blogs

Forums

Baseball Everywhere

By Ryan Booz

Comments posted to this topic are about the item Baseball Everywhere

How to run custom python module on SQL Server?

By yyang5823

I am working on a small test script on SQL server 2022 using python...

Upgrade to SQL2019 from 2012 Query is taking time, Need Query Optimization steps

By ralahari

Upgrade to SQL2019 from 2012 Query is taking time, Need Query Optimization steps and...

Visit the forum

Question of the Day

Sensitivity Ranks

I want to use the ADD SENSITIVITY CLASSIFICATION DDL to mark some columns in my SQL Server 2022 database as PII. Can I use this code?

ADD SENSITIVITY CLASSIFICATION TO dbo.sales.price,
    dbo.sales.discount
WITH (
    LABEL = 'Highly Confidential',
    INFORMATION_TYPE = 'Financial',
    RANK = 'INTERNAL ONLY'
);

See possible answers