Archive for the ‘SQL Server 2008’ Category
How to check the SQL Server Version
Posted by: admin in Database, MS SQL Server, SQL Server 2008 on May 5th, 2010
You can check the sql server version by using the SERVERPROPERTY function.
Exampe:
SELECT
SERVERPROPERTY(‘ProductVersion’) AS ProductVersion,
SERVERPROPERTY(‘ProductLevel’) AS ProductLevel,
SERVERPROPERTY(‘Edition’) AS Edition,
SERVERPROPERTY(‘EngineEdition’) AS EngineEdition;
GO
Difference between Clustered and Non-Clustered Index
Posted by: admin in Database, MS SQL Server, SQL Server 2008 on April 13th, 2010
- Clustered Index
- A clustered index is a special type of index that reorders the way records in the table are physically stored.
- Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
- Non-Clustered Index
- A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk.
- The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.
Rebuild Index Script for SQL Server
Posted by: admin in Database, MS SQL Server, SQL Server 2008 on March 12th, 2010
DECLARE @tblName VARCHAR(50)
DECLARE rs CURSOR FOR
SELECT TABLE_NAME FROM information_schema.tables WHERE [TABLE_TYPE] =N’BASE TABLE’
OPEN rs
FETCH NEXT FROM rs INTO @tblName
WHILE @@FETCH_STATUS = 0
BEGIN
DBCC DBREINDEX( @tblName,”,90)
END
CLOSE rs
DEALLOCATE rs