Skip to main content

Posts

Showing posts with the label SQL SERVER 2012

OFFSET-FETCH IN SQL SEVER 2012

OFFSET -FETCH option is filltering option that like ,top you can use fillter the data based on number of rows. Difference between TOP and OFFSET- FETCH Is OFFSET-FETCH it skippes the rows.In TOP Option it will not skip. The OFFSET-FETCH option is rigth after the order by . The order by is required when OFFSET-FETCH option includes. The OFFSET-FETCH option intorduced in SQL-SERVER 2012. We can use OFFSET-FECTH option implement pagenation. --create Employee table create table Employee (                 EmpId int identity ( 1 , 1 ) primary key ,                 FirstName varchar ( 100 ),                 LastName varchar ( 100 ),                 JoinDate ...

CONCAT FUNCTION IN SQL SERVER 2012

Concat function is used concatnating the values among the different arguments. Syntax: Concat([String1],[String2]..[StringN]);  DECLARE @FName VARCHAR ( 50 ), @LName VARCHAR ( 50 ); SET @FName = 'Rakesh' ; SET @LName = 'Kalluri' ; SELECT CONCAT ( @FName , ' ' , @LName ) as [FullName] ; Output: Rakesh Kalluri --Before SQL 2012 Versions we can use like this way DECLARE @FName VARCHAR ( 50 ), @LName VARCHAR ( 50 ); SET @FName = 'Rakesh' ; SET @LName = 'Kalluri' ; SELECT @FName + ' ' + @LName as [FullName] ; Output: Rakesh Kalluri --But Before SQL 2012 Versions there are 2 problems when we  contacting . --1.Need to replace NULL Value to Empty.if we directly concat NULL Value the  Entire  result also NULL. --Before 2012: DECLARE @FName VARCHAR ( 50 ), @LName VARCHAR ( 50 ); SET @FName = 'Rakesh' ; SELECT @FName + ' ' + @LName a...