Wednesday, October 29, 2008

SQL Doc™

Document SQL Server 2000, 2005 and 2008 databases without any hassle.

  • Fast, simple database documentation
  • Document one or multiple databases, down to object level
  • Write, edit, and export documentation in easy-to-read HTML files or .chm files for team distribution
  • Includes all cross-database dependencies
download trial version :
http://www.red-gate.com/supportcenter/Product.aspx?p=SQL%20Doc

Saturday, October 25, 2008

How to identify your SQL Server 2005 version and edition

To determine which version of Microsoft SQL Server 2005 is running, connect to SQL Server 2005 by using SQL Server Management Studio, and then run the following Transact-SQL statement:

SELECT
SERVERPROPERTY('productversion') as productversion,
SERVERPROPERTY ('productlevel') as productlevel,
SERVERPROPERTY ('edition') as edition

The results are:

* The product version (for example, "9.00.1399.06").
* The product level (for example, "RTM").
* The edition (for example, "Enterprise Edition").

sample results :

9.00.1399.06 RTM DeveloperEdition

Monday, October 20, 2008

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

One of strange error that i had to deal with is the one mentioned above. The error used to prompt more frequently when the number of records increased in table. So at the initial stage of developments you won't have this timeout error. But when the system is in operation level and when the production data increases you may haev to come across this timeout error.

There are two main Timeout property in ADO.NET.

1. Connection Timeout for Connection
2. Timeout for Data Access( Command Object or DataAdapter)

Setting Connection Timeout property for SQLConnnection object ?

You can't set timeout property in connection object because its a READ ONLY property.

The proper way to do this is to set the timeout value in connection string as mentioned below.

SqlConnection conn = new SqlConnection("server=Server;uid=sa;pwd=123456;database=myDB;Connection Timeout=120");

Setting the timeout property in DataAdapter or CommandObject.

SqlDataAdapter sqlAdapter = new SqlDataAdapter();
sqlAdapter.SelectCommand = new SqlCommand(sqlQuery, conn);
sqlAdapter.SelectCommand.CommandTimeout = 0;


Setting the timeout value to 0 will makes adapter or command to wait for indefinite time before terminating the attempt to execute a command and generating an error.
The default timeout value for connection object is 15 seconds.

hope this might help you to solve the problem.