SUBSTRING Function In SQL Server 2008

In this article i will explain how to use SUBSTRING Function in SQL.
  • 2940

Introduction

SUBSTRING() Function is a SQL string function. It returns the substring from a given character expression.

Syntax

SUBSTRING (expression, start, length)

where,

expression-  specifies character, binary, text or ntext to be given as SUBSTRING parameter.

start- It is one of the SUBSTRING function parameter which specifies where the returned characters start.

length- It specifies the number of characters to be returned.

Example

Suppose we have table named Employee as.

Create-Table-in-sql.jpg

Return 3 characters from 1st position of F_Name column.

SQL-SUBSTRING-function.jpg

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.