MID Function in SQL 2012
In this article I am going to explain how to use MID function in sql 2012.
Introduction
This function is used when we want to extract some characters from a given column.
Syntax
SELECT MID(column_name, start, length) from table_name
|
where,
column_name- specifies that column name whose characters you want to extract
start- specifies the starting position.
length- It is optional, it specifies number of characters to return.
Example
Suppose we have a table named "Employee" given in following image.
Extract first four characters from F_Name. Type following
SELECT MID(F_Name,1,4) as Name FROM Employee
|