03/10/2013 by Nitesh

Solution: The WITH MOVE clause can be used to relocate one or more files

Friends, Today working with SQL Server I was trying to restore a DB from .bak file and got a strange error while restoring using the normal procedure. I was working on SQL Server 2008 R2 and the backup was from an old version making me think the problem may be because incorrect SQL versions. The…

Continue Reading »

03/09/2013 by Nitesh

Solution: Error: 26 – Error Locating Server/Instance Specified

Friends, This is a very common problem that we face while working with SQL (be it any version of SQL) and we always spend some time to figure out the exact issue. Every time we need to look int where should we start looking for the problem. This post lists the basic issues that can…

Continue Reading »

02/06/2013 by Nitesh

How to calculate age based on 2 dates in SQL Server

Dear Friends, Often working with SQL server, we need to calculate the difference between 2 dates. We can get this done easily by using the DATEDIFF() function. Sometimes, we also need to calculate the age of a person on a specific date in SQL Server. SQL Server does not provide a direct function to do…

Continue Reading »

18/12/2012 by Nitesh

Solution: ExecuteNonQuery() always returning -1 when calling a Stored Procedure

Friends, This post details another solution to a very basic problem that we face in our development and tend to miss writing Stored Procedures. We know ExecuteNonQuery() function defined in the SqlCommand class returns the number of rows affected by the query we are executing. Sometimes, when calling a Stored Procedure using the ExecuteNonquery() from…

Continue Reading »

17/12/2012 by Nitesh

How to Retrieve File size of all Databases present in SQL Server on Hard Disk

Friends, In our previous post, we read about how can we get the file size of a SQL Server database on hard disk. In this post we will write a query that will return the file sizes of all the databases present on a SQL Server. Code below – CREATE TABLE #db_space ( [DBname] NVARCHAR(50),…

Continue Reading »

1 2 3 4