SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Latest Blog Posts

Command shell steps in SQL Agent jobs only process a single command.

I was working on a SQL Agent job recently that required a series of command shell commands. And it would not work. Days I spent fighting it. I eventually went to sqlhelp. And while no one was able to give me an easy answer directly, Randolph West ( Read more

0 comments, 47 reads

Posted in SQLStudies on 23 April 2018

How to Perform Database Hack-Attach

This blog demonstrates attaching a database on the SQL Server Instance which already has the same name database up and running.


Suppose, you got a hardware migration activity. The migration activity involves moving the databases from old hardware to new hardware. Let’s say the server got only one big… Read more

0 comments, 109 reads

Posted in SQL Geek on 23 April 2018

SQL Tuning: Finding statements for missing indexes

Missing indexes are an important part of the indexing strategy. I usually start with sys.dm_db_index_usage_stats to find both inefficient and unused indexes and then supplement with missing indexes.

The missing index DMVs are great but they’ve always been missing something.

What are they missing you ask? They currently tell… Read more

0 comments, 130 reads

Posted in Confessions of a Microsoft Addict on 20 April 2018

Checking Tempdb with dbatools

I really like the dbatools project. This is a series of PowerShell cmdlets that are built by the community and incredibly useful for migrations between SQL Servers, but also for various administrative actions. I have a short series on these items.

In SQL Server 2016, the setup program was… Read more

0 comments, 201 reads

Posted in The Voice of the DBA on 20 April 2018

Monitoring and Tuning Azure SQL Database at SQL Saturday Jacksonville and 24 Hours of Pass

I’m speaking at two upcoming events that I wanted to share with you! My topic is Monitoring and Tuning Azure SQL Database. Being able to monitor and tune the performance of your database is an important part of any database professional’s job. Azure introduces a host of new tools and… Read more

0 comments, 101 reads

Posted in SQL with Dustin Ryan on 20 April 2018

Easy to use WMI commands to query windows system

WMI has been around for a while and it has grown significantly over the years. With Microsoft's focus on powershell, WMI is maybe getting less visible in the public eyes.

This is not to say I am not a fan of powershell. But it can be bit daunting to get…

Read more

0 comments, 34 reads

Posted in Mission: SQL Homeostasis on 20 April 2018

SQL query to shrink all log files on sql instance

USE master

exec sp_MSforeachdb '

use [?]
 print ''?''
 print cast(databasepropertyex(''?'', ''Updateability'') as varchar(200))

 if databasepropertyex(''?'', ''Updateability'') = ''READ_WRITE ''

   dbcc shrinkfile(2,1)


Read more

0 comments, 32 reads

Posted in Mission: SQL Homeostasis on 20 April 2018

T-SQL Developer Interview Questions with Answers

What SQL command do you use to pull and filter data from a table ?  

SELECT [Column List] FROM [Table Name] WHERE [Condition = TRUE]
SELECT * FROM [Table Name] WHERE [Condition = TRUE]

How do you update data (what command do  you use)

Syntax to update data without…

Read more

0 comments, 31 reads

Posted in Mission: SQL Homeostasis on 20 April 2018

GUID or Integer Primary Key?

If you are designing a new data model or maybe you are looking to improve an existing one.  One of the key decision you would be making is what should be the primary key in each table.

Now first rule or best practice is that…

Read more

0 comments, 0 reads

Posted in Mission: SQL Homeostasis on 20 April 2018

SQL server database size, location and volume info

For one of my clients, I needed to know and document not only database names, size and locations but also disk volume information as well.

Here is a query I came up with to retrieve all that using a single script.



Read more

0 comments, 27 reads

Posted in Mission: SQL Homeostasis on 19 April 2018

Generate SQL script to extract user permissions from a SQL database

When you restore a database, it will also restore all permissions along with it. But what if you are restoring over an existing database and it has different sets of permissions and you would like to preserve those after the restore?

For example, due to security policy of your organization…

Read more

0 comments, 25 reads

Posted in Mission: SQL Homeostasis on 19 April 2018

How to check whether and when sql index statistics were updated last time?

I was working for a client on their very critical and heavily used database.  The application was an E-commerce website with a ratio of 1 write to 400 reads. 

The application would experience sporadic performance issues.  The expected response time was in sub-second and this expectation was met in general.…

Read more

0 comments, 25 reads

Posted in Mission: SQL Homeostasis on 19 April 2018

How to start SQL Server job using TSQL and wait for it to complete?

If you ever had a need to start a SQL job using sp_start_job stored procedure in msdb then you know once the job is started successfully, it returns the control back to the user immediately and does not wait for the job to complete.

But what if you want your…

Read more

0 comments, 24 reads

Posted in Mission: SQL Homeostasis on 19 April 2018

The Prompt Actions Menu

A quick post on SQL Prompt here. Someone is asking about the Prompt Actions menu. This is the menu that appears when you highlight code. I’ve got a quick animation of this working.

In the gif, I highlight code, click the Actions icon, and then I can add a BEGIN..END… Read more

0 comments, 214 reads

Posted in The Voice of the DBA on 19 April 2018

Overview of SQL Server Backup Types

SQL Server backups, in itself, is a vast subject; so vast, there are multiple books written about them. In this article, however, we are going to focus on the types of backups that are available to us, and understand how to pick what we need, and what aspects we base… Read more

0 comments, 131 reads

Posted in PowerSQL By Prashanth Jayaram on 19 April 2018

Bring Your Own Key to Azure SQL Database TDE

I have previously written about using Transparent Data Encryption (TDE) with Azure Key Vaule as a great way to store and manage encryption keys for SQL Server. With Azure SQL Database there has long been an option to enable TDE with just the click of a button. A lot of… Read more

0 comments, 187 reads

Posted in Bradley Schacht on 19 April 2018

Power BI Custom Visuals Class (Module 99 – Drill-Down Donut Chart

In this module you will learn how to use the Drill-Down Donut Chart. The Drill-Down Donut Chart allows you to visualize categorical data in an interactive drill-down chart.

Module 99 – Drill-Down Donut Chart


Read more

0 comments, 235 reads

Posted in Devin Knight on 19 April 2018

Finding Untrusted Foreign Keys and Constraints

In the previous blog, we discussed the Foreign Keys Constraints and how the CHECK Constraints are useful to verify the data that goes into your tables. But, sometimes when you need to load a lot of data quickly, SQL Server allows you to temporarily disable any CHECK or FOREIGN KEY… Read more

0 comments, 123 reads

Posted in SQL Geek on 19 April 2018

Python Jupyter Notebooks in Azure

There’s a new feature in Azure, and I stumbled on it when someone posted a link on Twitter. Apologies, I can’t remember who, but I did click on the Azure Notebooks link and was intrigued. I’ve gotten Jupyter notebooks running on my local laptop, but these are often just on… Read more

1 comments, 698 reads

Posted in The Voice of the DBA on 18 April 2018

Why Don't I have a Preferred Replica?

The client reported that the log file on their main database was growing unusually large, and when they checked the backup target the database didn't have any LOG backups!

Oh, and the database was part of an Availability Group.


After some investigation we found that while the Availability…

Read more

0 comments, 141 reads

Posted in Nebraska SQL from @DBA_ANDY on 18 April 2018

Older posts