Remove first n characters from string
To remove first n characters from a string or column using functions RIGHT or STUFF.
The RIGHT function returns the right part of a character string.
The STUFF function add a string into another string.
RIGHT
RIGHT ( character_expression , integer_expression )
STUFF
STUFF ( string , start , length , replaceWith_string )
RIGHT function
Remove first 5 characters with RIGHT function.
RTRIM function truncate all trailing spaces.
LEN function returns the length of the string.
select RIGHT(RTRIM('learntransactsql'), LEN('learntransactsql') - 5 ) ;
Result: transactsql
STUFF function
Remove first 5 characters with STUFF function.
Start with the first position and replace the first 5 characters with nothing.
select STUFF('learntransactsql', 1, 5, '');
Result: transactsql
Remove first n characters from a column
select STUFF(name, 1, 5, '') from courses where name='Mathematics';
Result: matics
SQL Server RIGHT function
SQL Server RTRIM function
SQL Server LEN function