How to get Processors Count in SQL Server ?

SQL Server 2000: CREATETABLE#TempTable ( [Index]VARCHAR(MAX), NameVARCHAR(MAX), Internal_ValueVARCHAR(MAX), Character_ValueVARCHAR(MAX) ) INSERTINTO#TempTable EXECxp_msver SELECTInternal_Value From#TempTable WHEREName=’ProcessorCount’ SQL Server 2005: select cpu_count / hyperthread_ratio AS PhysicalCPUs from sys.dm_os_sys_info  


SQL Server 2008 SP2 is released

SQL Server 2008 SP2 contains the following features: ·         All hotfixes released up to Microsoft SQL Server 2008 SP1 CU 8. ·         Updates to the Reporting Services Add-in for Microsoft SharePoint Products 2007 allowing customer to connect to SQL Server 2008 R2 Report Servers. ·         Support for SQL Server 2008 R2 version of Management Studio…


Setup Database Mail in SQL Server 2008

              i) Open SQL Server Management Studio->View Menu-> Select Template Explorer-> Expand Database Mail in the Template Explorer->Select the ‘Simple Database Mail Configuration’ templateit opens a SQL Server Template for database mail configurationClick Query Menu-> Select Specify Values for template parameters-> Enter profile name, account name, SMTP Server name,…


SQL Express is not installed properly. Steps to be taken before reinstall again

To verify the SQL Server Express instance installed, you could use Microsoft SQL Server 2008 Setup Discovery Report. For more information, please see the Setup Discovery Report doesn’t list the SQL Server Express instance, try the following steps to reinstall it:1. Make sure you have administrative rights on the computer2. Uninstall the existing SQL…


How to improve performance during Insertion

Here are the following guidelines to increase performance during INSERT operation:  1. Inserting data into a table with a single clustered index is slightly better than inserting the same data into the same table with a corresponding nonclustered index 2. If you are doing bulk copy of data, when possible, use the BULK INSERT statement instead…


How to find leastly used non-clustered indexes in SQL Server ?

Script:   SELECT objectname=OBJECT_NAME(s.OBJECT_ID) , , i.index_id  , reads=user_seeks + user_scans + user_lookups  , writes =  user_updates  , p.rows FROM sys.dm_db_index_usage_stats s JOIN sys.indexes i ON i.index_id = s.index_id AND s.OBJECT_ID = i.OBJECT_ID  JOIN sys.partitions p ON p.index_id = s.index_id AND s.OBJECT_ID = p.OBJECT_ID WHERE OBJECTPROPERTY(s.OBJECT_ID,’IsUserTable’) = 1  AND s.database_id = DB_ID() � AND i.type_desc…


SSMS for SQL Azure

Download links for SSMS in 32bit and 64bit flavors. The full download of SQL Server 2008 R2 November CTP can be found here.