15/12/2012 by Nitesh

How to Retrieve the File Size used by a SQL Server Database on Hard Disk

Friends, We all work with databases and while working with databases, we all have most probably SQL Server one version or the another. Today, in this post we will see how to retrieve the size of data files of all databases present in SQL Server and the actual amount used in these files. As you…

Continue Reading »

29/11/2012 by Nitesh

How to Execute a Query Stored in a variable in Stored Procedure

Friends, Today, I was working with SQL Server and found an interesting situation where I wanted to store my query in a variable in stored procedure and after preparing the query based on parameters, execute the query at the last. I came up with an interesting solution for this. Let us consider the below stored…

Continue Reading »

12/09/2012 by Nitesh

How to Select a random row with Microsoft SQL Server

A quick post for all – We often find situations where we need to retrieve random records from a MS SQL table. The below query does the same for you. To generate a random record from a table in Microsoft SQL Server, we need to execute the following query: SELECT TOP 1 * FROM tbl_name…

Continue Reading »

1 2 3 4