Remove First Character in SQL Server: Quick Guide

To remove the first character of a string in SQL Server, you can use the SUBSTRING function in conjunction with the LEN function. Here is an example:

DECLARE @string VARCHAR(50) = 'Hello World'

SELECT SUBSTRING(@string, 2, LEN(@string) - 1) AS NewString

In this example, we first declare a string variable @string and initialize it with ‘Hello World’. We then use the SUBSTRING function to extract a substring starting from the second character to the last character, and return it as a NewString column. The LEN function is used to get the length of the string in order to calculate the number of characters to be removed.

bannerAds