Tag Archives: SQL Functions

RIGHT() function in SQL Server

By | January 26, 2015

SQL Server – RIGHT () function Right():- This function returns the specified number of characters from the Right part of the given character string.Syntax:- Select RIGHT ( character_expression , integer_expression ) For example, the below query will return two characters from the last. Select RIGHT(‘Vivek’,2) Result ek

LEFT() function in SQL Server

By | January 26, 2015

LEFT() function in SQL Server Left():- This function returns the specified number of characters from the left part of the given character string. Syntax:-Select LEFT ( character_expression , integer_expression ) For example, the below query will return two characters from the beginning Select LEFT  (‘Vivek’,2) Result Vi

AVG() function in SQL Server

By | August 14, 2014

Avg():- This function is used to get the average value of a numeric column Syntax:-       SELECT AVG(column_name) FROM table_name In this article, we are going to use the following table for some examples:- CREATE TABLE [dbo]. [Employee]( [Empid] [Int] IDENTITY (1, 1) NOT NULL Primary key, [EmpNumber] [nvarchar](50) NOT NULL, [EmpFirstName] [nvarchar](150) NOT NULL,… Read More »

Substring() function in SQL Server

By | August 14, 2014

Substring():- This function is used to return the specified number (third argument “len”) of characters from a given string(first argument) from the start position as specified as the second argument. Syntax:-    Select  SUBSTRING ( expression ,start , length ) For example,        Select  SUBSTRING ( ‘kingmaker’ ,1 , 4 ) Result     king