Category Archives: SQL Functions

SQL Functions

SQL Server – Convert() function

By | January 24, 2015

Convert () function in SQL Server Convert () function is used to convert an expression from one data type to another data typeSyntax for CONVERT function CONVERT ( data_type [ ( length ) ] , expression [ , style ] ) Convert functions is usually used with date/time data type to convert a date in different formats. Below examples will… Read More »

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