substring in sql server code example

Example 1: sql server substring

SELECT SUBSTRING('SQL Tutorial', 1, 3) AS ExtractString;

Example 2: sql substring

SUBSTRING(string, start, length)

Example 3: grab part of a string sql

SELECT 
    SUBSTRING('SQLTutorial.org',
        POSITION('.' IN 'SQLTutorial.org'));

Example 4: substring sql

SELECT SUBSTR(first_name, 0 , 3)
From employees;

Example 5: substring sql

SELECT SUBSTRING('SQL Tutorial', 4, (LENGTH('SQL Tutorial')) 
                 AS LastCharactersString;
//Result -> Tutorial

Example 6: grab part of a string sql

SELECT SUBSTRING('SQLTutorial.org');