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

SQL Geek

Dharmendra is a SQL Server/Microsoft Data Platform professional with over eight years of experience. He enjoys helping others in the SQL Server community and does this by contributing on blogs, speaking at several SQL events. His passion and focus is to explore and share more and more on SQL Server.

Which are the queries using a particular index or table?

The DMV sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats give you excellent detailed information about how the indexes are being used and what operations are occurring (select, insert, update, delete) in the database.

But they don’t tell you a particular index or table is being used by which all the queries. So, when you… Read more

0 comments, 880 reads

Posted in SQL Geek on 7 May 2018

Determine Referenced Objects in the Stored Procedures

It is very common to see in a relational database that stored procedures are using many Tables, Views, Sequence Object, Stored Procedures, Functions, or many more to process the business logic. If you happen to work on a Stored Procedure performance issue which referenced many objects, you might end up… Read more

2 comments, 329 reads

Posted in SQL Geek on 1 May 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

3 comments, 1,178 reads

Posted in SQL Geek on 23 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

2 comments, 2,608 reads

Posted in SQL Geek on 19 April 2018

Find Missing Indexes For All SQL Server Databases

DMV (Database Management View) and DMO (Database Management Objects) were added in 2005. There have been huge improvements in each new edition of SQL Server. It provides us a lot of useful information about SQL Server like – expensive queries, wait type, missing index…., and the list goes on and… Read more

1 comments, 5,885 reads

Posted in SQL Geek on 16 April 2018

SQL Server Logical Query Processing

Recently, while reviewing one of the stored procedure performance, I suggested a couple of changes to a developer to improve the performance of the SP. One of the suggestions was to replace DISTINCT with GROUP BY.

A few days later, he came back to me with a performance matrix to… Read more

0 comments, 2,956 reads

Posted in SQL Geek on 12 April 2018

How to Check SQL Server View Utilization

If you are working on SQL Server optimization delicately, you may get often queries that how to find if any index, table or view is being used in database or not.

In recent past, we went live for one of the critical application. The developers decided to check through all… Read more

0 comments, 899 reads

Posted in SQL Geek on 9 April 2018

What is a Foreign Key & How many foreign keys can you have on a single table?

Yesterday, I was attending a database design meeting. In the meeting, I was asked one of the questions – “How many foreign keys can you have on a single table?” Honestly, I had no clue about the limit. But, I must acknowledge that it was an excellent question… Read more

2 comments, 3,020 reads

Posted in SQL Geek on 5 April 2018

How SQL Compilation Can Prove the Server CPU

It is relatively easy to spot CPU-bound system. But, the source of CPU pressure is not always easy to pinpoint. The CPU can be driven by many factors on the server such as;

  • Memory pressure which is causing SQL Server to continually move data in and out of the memory.

Read more

4 comments, 402 reads

Posted in SQL Geek on 2 April 2018

SQL Performance – Using Query Hint OPTION (FAST N)

It is fun working with SQL/Application developer where you exchange a lot of technical thoughts to find the root of the issues. Recently, one of the developers optimized the OLTP system stored procedure by putting the query hint OPTION (FAST ‘N’). But, he was not sure enough about… Read more

2 comments, 2,884 reads

Posted in SQL Geek on 21 March 2018

New Built-in Function CONCAT_WS() – SQL Server 2017

In my previous post on new functions in SQL Server 2017, I discussed about the STRING_AGG function. Here, I am going to discuss about the function CONCAT_WS.

This function concatenates a variable number of arguments with a delimiter specified in the first argument.

Syntax for the function

CONCAT_WS ( separator,…

Read more

0 comments, 1,353 reads

Posted in SQL Geek on 2 March 2018

Set New Errorlog File location – SQL Server on Linux

For SQL Server 2017 RTM, the fourth cumulative update was released on 20th February, and it is available for download at the Microsoft Downloads site. It brought a couple of significant improvements like;

Read more

0 comments, 1,561 reads

Posted in SQL Geek on 1 March 2018

New Built-in Function STRING_AGG() – SQL Server 2017

SQL Server 2017 introduces a set of useful functions like STRING_AGG(), STRING_SPLIT(), TRIM()… and many more. In this tip, I am going to discuss one of the built-in aggregate functions – “STRING_AGG()”.

The function concatenates values from rows as one value with a separator, and the main advantage is it… Read more

2 comments, 9,325 reads

Posted in SQL Geek on 28 February 2018

Who installed SQL Server?

Recently, I was working with the team and got stuck up with SQL Server Installation information. We got an urgent requirement to patch the physical box from Windows team.

As the server was not in production, so the server entry was missing. Since Windows team wanted to take action on… Read more

2 comments, 2,797 reads

Posted in SQL Geek on 27 February 2018

Change the name of master database files – SQL Server on Linux

In my recent blog, I discussed about how to move master database to another location. One of the readers requested to blog about renaming the master database files. So, we are going to explore step by step process of renaming the files in this blog.

Change the name of…

Read more

0 comments, 727 reads

Posted in SQL Geek on 26 February 2018

How to Move Master Database to Another Location – SQL Server On Linux

With the release of SQL Server 2017 CU4, you can use the mssql-conf utility to move the master database file to another location. By default, master database is located at the location /var/opt/mssql/dataNow, if you want to change the location of master database file to a different location,… Read more

0 comments, 2,057 reads

Posted in SQL Geek on 23 February 2018

Capture SQL Server Reported Errors using Extended Events

In my introduction to Extended Events blog, I mentioned that the xEvent is my favorite toy for performance troubleshooting. This blog may make you to start playing with it. In this tip, I will be discussing how you can find what caused SQL Server to write error in the… Read more

0 comments, 3,394 reads

Posted in SQL Geek on 20 February 2018

Extended Event Packages

I continue blogging on extended events. Today, I will discuss about the top level containers (Package) that gives access to one or more smaller items inside of extended Events

Extended Event Packages Definition

In the Extended Events Engine, Packages are registered inside the modules and contain the information about what… Read more

0 comments, 250 reads

Posted in SQL Geek on 25 January 2018

Mapping SQL Trace to Extended Events

Since I started actively participating in SQL community, I found it is very common that people will approach to seek help on their SQL related issues. I do love to help people because it is always a win and win situation for both of us.

Recently, I had a phone… Read more

1 comments, 1,162 reads

Posted in SQL Geek on 19 December 2017

Reset SA password on SQL Server on Linux

This article is about how to proceed when you forgot the password of your SQL Server “sa” account, Password was entered wrong many times then “sa” account got locked, or someone wants to reset the password without using SQL Server management studio (GUI).

The mssql-conf is a configuration tool that… Read more

4 comments, 6,464 reads

Posted in SQL Geek on 11 December 2017

Newer posts

Older posts