sql get first letter of string code example

Example 1: sql first character

Select First two Character in selected Field with Left(string,Number of Char in int)

SELECT LEFT(FName, 2) AS FirstName FROM dbo.NameMaster

Example 2: sql server substring

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

Example 3: grab part of a string sql

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

Example 4: substring sql

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

Example 5: grab part of a string sql

SELECT SUBSTRING('SQLTutorial.org');

Tags:

Sql Example