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

Archives: June 2013

SQL Server – How to Enable a Disabled SQL Server Login

When an account is disable it cannot be used to login to SQL Server. You will receive below error when logging-in to SQL Server using a disabled Login account:

You can enable a disabled SQL Server Login using SQL Server Management Studio or via T-SQL code.


To enable a… Read more

2 comments, 888 reads

Posted in SQL and Me on 24 June 2013

SQL Server – Update Table with INNER JOIN

Often we may need to update a column in a table based of another column in another table.

In SQL Server you can do this using UPDATE statement by joining tables together.

To understand this better let’s take a look at below contrived example.

USE [SqlAndMe]



SELECT CustomerID Read more

1 comments, 1,075 reads

Posted in SQL and Me on 18 June 2013

SQL Server – How to get sizes of all databases on a server

To get database size information we can use sys.master_files catalog view. This view contains a row per file of a database for all databases.

The columns of interest for retrieving database size information are:

Column Name Description
database_id ID of the database to which the file belongs to
type_desc Description…

Read more

8 comments, 1,144 reads

Posted in SQL and Me on 10 June 2013

SQL Server – How to Detach a Database

To move a database from one location to other you fist need to detach the database from server. In this article we will learn different ways to detach a database from server.

There are two different methods available to detach a database from a server.

Method 1. Detach a Database… Read more

0 comments, 1,050 reads

Posted in SQL and Me on 3 June 2013