Following are the list of Sql Server 2008 Articles which I have blogged.
SQL SERVER 2008 | |
|
|
Variable declaration allows initialization | |
Prior to Sql Server 2008 to initialize a variable, we needed to first declare the variable and then we can initialize it by using SET/SELECT statement as shown below:
DECLARE @COUNT INT SET @COUNT =100
DECLARE @COUNT INT =100
|
|
Insert multiple rows using single INSERT Statement | |
To understand this feature first create an Employee Table by using the below script:
CREATE TABLE DBO.Employee ( Id INT, Name VARCHAR(50) ) Prior to Sql Server 2008, to insert multiple records we use to write statements like below: INSERT INTO dbo.Employee VALUES(1,'Basavaraj') INSERT INTO dbo.Employee VALUES(2,'Shashank') INSERT INTO dbo.Employee VALUES(3,'Monty') Now in Sql Server 2008 we can accomplish the same by writing script like below: INSERT INTO dbo.Employee VALUES(1,'Basavaraj') , (2,'Shashank') , (3,'Monty') |
|
Arithematic Assignment Operators | |
Now Sql Server 2008 also supports the Arithematic Assignment Operators like the below ones:
Operator Usage Description += SET @x+=@y Same as: SET @x = @x + @y -= SET @x-=@y Same as: SET @x = @x - @y *= SET @x*=@y Same as: SET @x = @x * @y /= SET @x/=@y Same as: SET @x = @x / @y %= SET @x%=@y Same as: SET @x = @x % @y Example: DEClARE @x INT =2 ,@y INT = 2 SET @x+=@y SELECT @x as x,@y as y Result: x y ----------- ----------- 4 2 |
|
Filtered Indexes |
Filtered Index (i.e. Index with where clause) is one of the new feature introduced in Sql Server 2008. It is a non-clustered index, which can be used to index only subset of the records of a table. As it will have only the subset of the records, so the storage size will be less and hence they perform better from performance perspective compared to the classic non-clustered indexes. For detailed information on filtered index you can go through the article A-Z of Filtered Indexes with examples in Sql Server Below is an example Filtered Index Creation Script: SET QUOTED_IDENTIFIER ON GO CREATE NONCLUSTERED INDEX IX_Emplyoee_EmployeeId ON Employee(EmployeeId) WHERE EmployeeId > 500 GO Before using filtered index please go through the below article, which explains the issue which we may face due to filtered index. |
sir,
What is the use of stuff and XML PATH Function in SQL SERVER.. Please explain it with example
How to handle XML data’s in SQL server. Please give brief example about that