SQL Delete Duplicate Rows from a SQL Table in SQL Server There are scenarios when you need to DELETE Duplicate Rows in SQL Server Table or REMOVE Duplicate Rows in SQL Table. Deleting Duplicate Records from...
Search results for - sql server
Does SQL Server Database Use Any Enterprise Edition Features?
One of the most common tasks performed by the DBA is to moving user databases across different editions of SQL Server especially during Disaster Recovery Situations. There are some Enterprise Edition only features which...
Discover SQL Server Components Installed Using SQL Server Discovery Tool
Microsoft Introduced SQL Server Discovery Tool is widely used by SQL Server Database Administrators to quickly identify SQL Server Components which are already installed on a local SQL Server. The report shown in the...
Different States of SQL Server Database
SQL Server Database can reside in one among the seven states. For example these can be ONLINE, OFFLINE, RESTORING, EMERGENCY, SUSPECT etc. This article explains each of these states and includes a T-SQL code which can...
How to Get SQL Server Instance Information
In this article we will take a look at different ways in which a DBA or a Developer can Retrieve System and SQL Server Information. The method mentioned is applicable for SQL Server 2005 and all higher versions. Below...
How to Use SQL Server Configuration Manager
How to Use SQL Server Configuration Manager to Manage SQL Server Services, Configure Network Protocols, and Network Connectivity Configuration “SQL Server Configuration Manager” is a tool that can be used to...
How to Configure a Contained Database Feature in SQL Server
Contained Databases is a new feature which was initially introduced in SQL Server 2012. A contained database is a database that will store all its metadata within the database thereby not storing any configuration...
How to Manage SQL Server Failover Cluster using Command Line
In this article we will take a look at how to manage SQL Server Failover Cluster Using Command Line. If you are managing multiple clusters then the following article will be of help How to Identify SQL Server...
How to Identify SQL Server Cluster Node and Shared Drives Information Using TSQL Queries
When you have a Multiple SQL Server Cluster Configuration and multiple shared drives it becomes tough to know which SQL Server Failover Cluster Instance is using which Shared Drives. This article has the collection of...
How to Identify CPU Bottlenecks in SQL Server Using Performance Counters
There are instance when you are facing CPU bottlenecks on your SQL Server Instance. In this article we will take look at How to Identify CPU Bottlenecks in SQL Server Using Performance Counters.The most common reason...
How to Detach SSAS Database in SQL Server
This article explains How to Detach Analysis Services Database in SQL Server. The steps mentioned in this article are applicable on SQL Server 2008 and Higher Versions. Different ways to Detach an Analysis Services...
How to Attach SSAS Database in SQL Server
This article explains How to Attach Analysis Services Database in SQL Server. The steps mentioned in this article are applicable on SQL Server 2008 and Higher Versions. Different ways in which an Analysis Services...
How to Restore Analysis Services Database in SQL Server Using SQL Server Management Studio
In this article we will take a look at the steps which a database administrator needs to follow to restore an analysis services database. The steps mentioned below are applicable on SQL Server 2005 and higher versions...
How to Automate Backup of Analysis Services Database Using SQL Server Agent Job
In this article we will take a look at how to create an SQL Server Agent Job to backup an Analysis Services Database. However, read the following article to know the steps you need to follow to restore a database in SQL...
How to Backup Analysis Services Database in SQL Server Using SQL Server Management Studio
In this article we will take a look at the steps which a database administrator needs to follow to backup an analysis services database. The steps mentioned below are applicable on SQL Server 2005 and higher versions...
Database Consistency Checker DBCC CHECK For Analysis Services Database in SQL Server 2016 for Tabular and Multidimensional Databases
In SQL Server 2016 you will see a new feature in Analysis Services to perform Database Consistency Checker (DBCC Check) to find corruption issue against Analysis Services Database or in Individual Objects. The Database...
Improved Startup Parameters in SQL Server 2012
Microsoft has improved the configuration of startup parameters in SQL Server 2012 and it is much simpler and easier. In this article we will take a look at the steps to add a Trace Flag 1222 to identify deadlocks in SQL...
SQL Server Database Engine Service Startup Options
SQL Server Database Engine supports different startup options for SQL Server Database Engine Service. A database administrator can set the startup options very easily using SQL Server Configuration Manager. In this...
How to Uninstall SQL Server 2008 Step by Step Guide
This article is a step by step guide which can be used by database administrators to Uninstall SQL Server 2008 Enterprise Edition. Step by Step Guide to Uninstall SQL Server 2008 / 2008 R2 Step 1: Click Start | Control...
How to Configure TempDB on Local Disk in SQL Server 2012/2014 Failover Cluster to Improve Performance
Starting SQL Server 2012 Failover Cluster installation supports Local Disk to be used for TempDB Data and Log files. This article explains the steps to be followed by the DBA to configure SQL Server 2012 Failover...
SQL Server WHERE Clause T-SQL Tutorial with Examples
The WHERE Clause is used to fetch records from a table which meets the condition mentioned in the WHERE Clause. This is Part 5 of 40 Part SQL Server T-SQL Tutorial. Click here to read it from the beginning…. WHERE...
SQL Server ORDER BY Clause T-SQL Tutorial with Examples
The ORDER BY Clause is used to order the result set in ascending or descending order. By default, when ORDER BY clause is used the result set is ordered in the ascending order. This is Part 4 of 40 Part SQL Server T-SQL...
SQL Server SELECT DISTINCT Clause T-SQL Tutorial with Examples
The SELECT DISTINCT Statement is used to fetch distinct values in a specific column of a given table. This article gives you an overview of the SQL Server SELECT DISTINCT clause or SELECT DISTINCT SQL Clause. This is...
SQL Server SELECT TOP Clause T-SQL Tutorial with Examples
The SELECT TOP Clause is used to specify the percentage of rows or to specify the number of rows which needs to be retrieved from a given table. This is Part 2 of 40 Part SQL Server T-SQL Tutorial. Click here to read it...
Database Backup Encryption in SQL Server 2014 a Step by Step Implementation Guide
Microsoft has introduced inbuilt Database Backup Encryption Feature in SQL Server 2014. Starting SQL Server 2014, SQL Server will have the ability to encrypt the data while the backup is in progress. One can encrypt the...
How to Fix “BACKUP detected corruption in the database log” Error in SQL Server
Due to an unplanned reboot of SQL Server one of the transaction log file of a database become corrupt. DBA noticed this issue once regular transaction log backup job started failing with “BACKUP detected...
How to Restore Database in SQL Server?
Summary This article mentions different methods to restore the database in SQL Server from the backup files (.bak files). You can RESTORE a database from a backup file using SQL Server Management Studio (SSMS) or...
Backup Database SQL Server
SQL Backup | How to Create a Full Backup of Database in SQL Server This article explains the steps you need to follow to take a FULL Backup of Database in SQL Server Using SQL Server Management Studio and by using TSQL...
How to Drop Database in SQL Server by Closing Existing Connections
SQL Server DROP Database | SQL DROP Database Statement This article outlines the steps to DROP Database in SQL Server when the users are connected to a SQL Server Database. You may need to closing existing connections...
How to Fix Cannot execute script. Insufficient memory to continue the execution of the program (mscorlib) error in SQL Server
How to Fix Insufficient memory to continue the execution of the program (mscorlib) error in SQL Server Database Administrators often need to get involved in code deployments wherein they release new code from one...
How to Enable XP_CMDSHELL & Disable XP_CMDSHELL using SP_CONFIGURE in SQL Server
How to Enable xp_cmdshell | How to Disable xp_cmdshell In this tip we will take a look at the step to follow to Enable XP_CMDSHELL and how to Disable XP_CMDSHELL using SP_CONFIGURE system stored procedure. In order to...
How to Repair Database in Suspect Mode in SQL Server
Summary There are times when you connect to an SQL Server Instance you will find the database being marked as SUSPECT. In such a scenario, you will not be able to connect to the database to read and write data...
How to Start SQL Server without TempDB Database
Recently, after the scheduled maintenance window when the database administrator started the SQL Server it failed to start due to corruption issues with storage subsystem. On further investigation it was identified that...
SQL Server Articles and Tips Categories
SQL Server Categories COVID-19 (1) DBA (89) Developers (34) Disaster Recovery (17) Learn SQL Server (15) PowerShell (1) SQL Server (107) SQL Server 2016 (15) SQL Server Analysis Services (7) SQL Server Tips (20) SQL...
Identify Deadlocks Using Graphical Deadlock Chain Event in SQL Server Profiler
This article explains how to identify deadlocks in SQL Server using graphical deadlock chain event in SQL Server Profiler. We would highly recommend you to read “Identify Deadlocks in SQL Server Using Trace Flag 1222...
How to Monitor Transaction Log File Usage in SQL Server
As a Best Practice database administrator should always monitor the space usage within the SQL Server Transaction Log file. This will help you quickly understand how much space the Transaction Log file is using during...
Why to Configure Database Instant File Initialization in SQL Server? Advantage
Why to configure Database Instant File Initialization in SQL Server? Its Advantages SQL Server Database Administrators can leverage Database Instance File Initialization Feature which is available in Microsoft Windows...
Different Ways to Enable Dedicated Administrator Connection in SQL Server
Microsoft introduced Dedicated Administrator Connection (DAC) feature in SQL Server 2005 and higher versions. Using DAC feature a database administrator can connect to an SQL Server Instance when SQL Server stops...
How to Use Dedicated Administrator Connection in SQL Server
To use a Dedicated Administrator Connection (DAC) in SQL Server, open new query window and in Connect to Server dialog box one need to prefix the word “admin:” before the SERVERNAME as shown in the...
Steps to Connect to SQL Server When all System Administrators are Locked Out
Getting Sysadmin Access to SQL Server When Locked Out SQL Server Security is one of the key responsibilities of a Database Administrator. However, there can be scenarios when a DBA will be asked to manage SQL Server...
How to Backup and Restore Resource Database in SQL Server
Microsoft SQL Server 2005 introduced a new system database namely Resource database. It’s a read-only system database which is hidden from users and in this article we will discuss how to backup and restore Resource...
How to Fix Virtual Log Files in SQL Server Transaction Log
This article demonstrates How to Fix Virtual Log Files in SQL Server Transaction Log file. The steps mentioned in this article are applicable on SQL Server 2005 and higher versions. To know more about how to Identify...
How to Detect Virtual Log Files in SQL Server Transaction Log File
This article demonstrates how to Detect Virtual Log Files in SQL Server Transaction Log File. The steps mentioned in this article are applicable on SQL Server 2005 and higher versions. To know more about how to fix...
What are Virtual Log Files in SQL Server Transaction Log File?
Every transaction log file is logically divided into smaller segments and these segments are called Virtual Log Files or VLFs. VLF stands for Virtual Log File in SQL Server Transaction Log File How Virtual Log Files...
Why Model Database Default Settings Customization is Important for SQL Server?
What is a Model System Database? Model is a system database which is used as a template while creating newer user databases in SQL Server. Why you must make necessary changes to default settings of a Model System...
Where can I find SQL Server Management Studio for SQL Server 2016?
After the successfully installation of SQL Server 2016, I have realized that SQL Server Management Studio 2016 (SSMS) is missing. In this tip we will discuss how to download and install SQL Server Management Studio for...
How to Download WideWorldImporters Sample Database and Restore in SQL Server 2016
Microsoft has introduced a new sample database WideWorldImporters specifically for SQL Server 2016. Let us take a look at how to download and restore SQL Server 2016 WideWorldImporters Sample Database. Steps...
How to Increase Number of SQL Server Error Log Files
SQL Server Error Log is the best place for a Database Administrators to look for informational messages, warnings, critical events, database recover information, auditing information, user generated messages etc. By...
Limit SQL Server Error Log File Size in SQL Server
SQL Server Error Log contains valuable information which can be used by database administrators to troubleshoot issues with SQL Server. A typical Error Log file contain informational messages, warnings, critical events...
How to Recycle SQL Server Error Log file without restarting SQL Server Service
SQL Server Error Log is the best place for a Database Administrators to look for informational messages, warnings, critical events, database recover information, auditing information, user generated messages etc. SQL...
How to Identify the Location of Resource Database in SQL Server
In this article we will take a look at how to identify the location of Resource database in SQL Server using a TSQL script. Importance of Resource Database in SQL Server Microsoft initially introduced Resource database...
SERVERPROPERTY Function T-SQL Enhancement in SQL Server 2016
SERVERPROPERTY is an inbuilt function which gives you information about the server instance. Learn How To Get SQL Server Info Using SERVERPROPERTY Function in SQL Server. This is Part 10 of 10 Part T-SQL Enhancements in...
STRING_SPLIT Function and STRING_ESCAPE Function in SQL Server 2016
SQL Server 2016 introduces two new string functions namely STRING_SPLIT and STRING_ESCAPE. This is Part 8 of 10 Part T-SQL Enhancements in SQL Server 2016 for Developers and DBAs. Click here to read it from the...
COMPRESS and DECOMPRESS T-SQL Enhancement in SQL Server 2016
SQL Server 2016 introduces two new system functions namely COMPRESS and DECOMPRESS. This is Part 7 of 10 Part T-SQL Enhancements in SQL Server 2016 for Developers and DBAs. Click here to read it from the beginning…...
ALTER DATABASE SET AUTOGROW_ALL_FILES T-SQL Enhancement in SQL Server 2016
SQL Server 2016 introduces two new options to ALTER DATABASE statement which can be used to modify database files namely AUTOGROW_SINGLE_FILE and AUTOGROW_ALL_FILES. In the earlier versions of SQL Server...
ALTER DATABASE SET AUTOGROW_SINGLE_FILE T-SQL Enhancement in SQL Server 2016
SQL Server 2016 introduces two new options to ALTER DATABASE statement which can be used to modify database files namely AUTOGROW_SINGLE_FILE and AUTOGROW_ALL_FILES. In the earlier versions of SQL Server...
MAXDOP for DBCC CHECKDB, DBCC CHECKTABLE and DBCC CHECKFILEGROUP T-SQL Enhancement in SQL Server 2016
SQL Server 2016 brings MAXDOP settings, for DBCC CHECKDB, DBCC CHECKTABLE and DBCC CHECKFILEGROUP command. Database Administrators can leverage MAXDOP settings to above mentioned DBCC commands to achieve Max Degree of...
ALTER TABLE WITH (ONLINE=ON | OFF) T-SQL Enhancement in SQL Server 2016
SQL Server 2016 introduces an interesting T-SQL enhancement to improve performance and reduce downtime ALTER TABLE WITH (ONLINE = ON | OFF). This statement will help you alter data types, change column/table collation...
DROP IF EXISTS SQL Server T-SQL Enhancement in SQL Server 2016
DROP IF Exists SQL Server | DROP IF Exists Table | DROP IF Exists Procedure SQL Server 2016 introduces a new DROP IF EXISTS SQL Server statement to DROP objects such as tables, columns, indexes, stored procedures...
TRUNCATE TABLE WITH PARTITIONS T-SQL Enhancement in SQL Server 2016
Truncate Table WITH Partitions SQL Server | Truncate Table SQL Server | It is a well known fact that TRUNCATE TABLE is faster than DELETE statement. TRUNCATE TABLE SQL Server uses lesser system resources and transaction...
How to Enable an Index in SQL Server
In this article we will take a look at how to enable an index in SQL Server. This is a very useful feature which will help you enable an index which was disabled earlier to check whether the index was really useful or...
How to Disable an Index in SQL Server
In this article we will take a look at how to disable an index in SQL Server. This is a very useful feature which will help you identify whether the index is really useful or not without actually dropping the index...
How to Change SQL Server Login Properties to Enforce Password Policies and Expiration Settings
How to set SQL Server Password Policy | Set SQL Password Policy This article demonstrates the steps to create an SQL Server Login which enforces password policies and password expiration policies. Let us start by...
Troubleshooting The remote procedure call failed. [0x800706be] WMI Error in SQL Server
You may end up getting “The remote procedure call failed. [0x800706be] WMI Error“ when you click SQL Server Services in SQL Server Configuration Manager as shown in the snippet below. This article explains the steps to...
SQL Server Tutorials Detailed Step by Step Guide with Examples
The SQL Server Tutorial on MyTechMantra.com would provide practical knowledge to beginners, and hands-on examples will help you learn SQL Server quickly and effectively.
TAIL-LOG Backup in SQL Server Step by Step Tutorial with Examples
A tail-log backup captures any log records which has not yet been backed up i.e., the tail of the transaction log to prevent any work loss and to keep the transaction log chain intact. Before you can recover a SQL...
PARTIAL Backup in SQL Server Step by Step Tutorial with Examples
As per MSDN “PARTIAL Backups are designed for use under SIMPLE recovery model; thereby to improve flexibility to backup very large database which contain one or more read-only Filegroups. They are useful whenever...
FILEGROUP Backup in SQL Server Step by Step Tutorial with Examples
Using FILEGROUP backup one can backup all the data files within the SQL Server FILEGROUP individually. While backing up the database you can specify whole of FILEGROUP (i.e., PRIMARY or SECONDARY) instead of specifying...
FILE Backup in SQL Server Step by Step Tutorial with Examples
Using FILE backup one can backup SQL Server Data File individually. While backing up the database you can specify whole of FILEGROUP instead of specifying each database file individually within the FILEGROUP. In case if...
MIRRORED Backup in SQL Server Step by Step Tutorial with Examples
Using MIRRORED Backup feature a DBA can create up to 3 identical copies of a database backup. This feature is available in SQL Server 2005 Enterprise Edition and later versions. This is Part 12 of 16 Part SQL Server...
COPY_ONLY Backup in SQL Server Step by Step Tutorial with Examples
COPY_ONLY backup is a special type of SQL Server Backup which is independent of the sequence of conventional SQL Server backups. Normally whenever you take a backup it will affect how later backups are restored...
TRANSACTION LOG Backups in SQL Server Step by Step Tutorial with Examples
Transaction log backup is only possible when your database is in FULL or BULK-LOGGED recovery model. With the help of Transaction Log backup one can achieve Point in Time recovery for the database in case of any...
DIFFERENTIAL Database Backups in SQL Server Step by Step Tutorial with Examples
What is a Differential Backup SQL Server? Differential Backup SQL Server will only record the data which has changes since the last successful full database backup. Differential Backup SQL Server | Differential Database...
FULL Database Backups in SQL Server Step by Step Tutorial with Examples
FULL Database Backup is used to back up the whole database in SQL Server. A database full backup will include parts of transaction log so that if the need arises a database can be recovered completely by restoring full...
Permissions Required to Take Database Backup in SQL Server
For a user to take database backups in SQL Server a user must be a member of DBCREATOR Server Role and DB_OWNER Database Role. Else you will receive the below mentioned error while performing backups...
Different Types of SQL Server Backups
SQL Server supports different types of backups for databases. However, which type of a database backup can be performed totally depends upon the recovery model of the database one choose. If you are unclear of the...
SQL Server BULK-LOGGED Recovery Model Step by Step Tutorial with Examples
When a database is configured to use a BULK-LOGGED Recovery Model then SQL Server will log minimal amount of information for operations such as SELECT INTO, BULK INSERT, BCP, CREATE INDEX, ALTER INDEX, and REBUILD INDEX...
SQL Server FULL Recovery Model Step by Step Tutorial with Examples
In Full Recovery Model Point in Time recovery of the database is possible as long as you have all the valid database backups along with the transaction log tail backup file. In Full Recovery model all the transactions...
SQL Server SIMPLE Recovery Model Step by Step Tutorial with Examples
SIMPLE Recovery Model in SQL Server SIMPLE Recovery Model as the name suggests it is the most basic recovery model which is available in SQL Server. In this recovery model every transaction is written to the...
Different SQL Server Recovery Models Step by Step Tutorial with Examples
Recovery Models in SQL Server are basically designed to control the transaction log maintenance and to help you recover your data from a disaster. Based on the choice of Recovery Model, SQL Server decides which data it...
SQL Server Database Backup Tutorial with Examples
Introduction It is very critical for any organization to protect its data within the database. Hence it is must for an organization to perform database backups at regular intervals. In this tutorial, you will learn...
How to Start SQL Server in Single User Mode?
There can be certain scenarios when one needs to connect to an SQL Server Instance in a Single User Mode by using the Startup Option -m. For example, the need could be to recover a damaged system database such as...
SQL Server: How to Start SQL Server with Minimal Configuration
Introduction There can be certain scenarios when SQL Server is not starting because of configuration problems. During such scenarios one need to start an instance of SQL Server by using minimal configuration...
Download SQL Server 2016 Developer Edition for Free
SQL Server 2016 Download Developer Edition for Free Microsoft announced the release of the Release to Manufacturing (RTM) version of SQL Server 2016 on June 1, 2016. The good news is that you can download SQL Server...
How to Export records from SQL Server to Text File using BCP Command
Introduction Is there a quick way to export records from SQL Server to text file? In this tip we will take a look at an example to export records from SQL Server to text file using BCP. In this tip we will learn how to...
Configure Network Drive Visible for SQL Server During Backup and Restore Using SSMS
Introduction Most of the Development and Test Database Servers will not have enough disk space to store both the database and backup files in order to perform the periodic database refreshes. In such scenarios, the best...
Troubleshooting SQL Server blocked access to procedure sp_send_dbmail
Use sp_send_dbmail to send email from SQL Server | How to Use Database Email SQL Server Feature Troubleshooting SQL Server blocked access to procedure ‘dbo.sp_send_dbmail’ of component ‘Database Mail...
Download SQL Server 2014 Developer Edition Free
Introduction Download Microsoft SQL Server 2014 Developer Edition for Free for Visual Studio Dev Essentials Members Microsoft has announced that the SQL Server 2014 Developer Edition will available for free to Visual...
Convert Seconds to Minutes, Hours and Days in SQL Server
As a developer there are times when yo need to convert seconds to minutes, hours and days. The TSQL script mentioned in this article can be used to easily Convert Seconds to Minutes, Hours and Days. Learn How to FORMAT...
Different Ways to Find Default Trace Location in SQL Server
How to Find SQL Server Default Trace Location Starting SQL Server 2005, Microsoft introduced a light weight trace which is always running by default on every SQL Server Instance. The trace will give very valuable...
SQL Server: How to Find which user deleted the database in SQL Server
Introduction In this article we will take a look at the steps which you can follow to quickly identify the user who deleted the user database in SQL Server. There are two different methods by which one can easily find...
How to Change SQL Server Database Auto Growth Settings
Introduction In this article we will go through the steps to change SQL Server Database Auto Growth Settings. It is always a best practice to set an appropriate auto growth setting for all Production database to a...
How to Repair Suspect Database in SQL Server
There can be a possibility that when you connect to an SQL Server Instance you will find the database being marked as SUSPECT. During such scenarios, you will not be able to connect to the database. Steps to Fix...
Fix Cannot open user default database. Login failed. Login failed for user SQL Server Error
In this article we will take a look at the steps which you need to follow when you receive “Cannot open user default database. Login failed. Login failed for user ‘UserName’. (Microsoft SQL Server, Error: 4064)“ SQL...
Identify Deadlocks in SQL Server Using Trace Flag 1222 and 1204
This article outlines the steps which one can follow to enable Trace Flag 1222 on SQL Server to capture deadlock information. You can also use Trace Flag 1204 in conjunction with Trace Flag 1222. Difference between...
SQL Server Best Practice Auto Close Database Option Should Remain OFF
Introduction In this article, we will take a look at why it is essential to leave AUTO CLOSE database option turned OFF for a Production or a Non-Production SQL Server Database across all versions and editions of SQL...