Microsoft SQL Server (MS SQL Server) Tutorial and Guide

What is SPARSE Column in MS SQL SERVER?

Introduced in SQL Server 2008, The SPARSE column is better at managing database size when null values are plenty in that particular column. This is lesser know column type but very useful when you...

How to convert XML to JSON in MS SQL SERVER

JSON is a data-interchange format that is both Human and Machine readable. It is easy for developers to interpret and pinpoint the issues, if any, during debugging when working with JSON. If the data...

How to get record count of large or locked tables in MS SQL?

Ever wondered why it takes so much time to get the count of rows in an SQL table with millions of records?  In case when the table is large and fragmented the ‘select count(*) from...

How to optimize T-SQL Query in MS SQL Server

As an T-SQL Developer, we always tend to wonder why my query takes considerately more time when everything is set on the server including indexes, fragmentation, fill_factor, etc. Well, these things...

How to send database emails using sendgrid SMTP T-Sql

Now this is tricky and pretty impulsive when you try to send emails from database using SendGrid and the mail fails to get send and the log reads out a generic message as ‘The mail could not be...

When to use Temp Table, Table Variable and CTE.

As a layman or a novice, when we come across the concept of local temporary tables, global temporary tables, table variables or common table expressions; we tend to think that they function similarly...