Home Forums SQL Server 7,2000 T-SQL Select Command while dropping first 2 characters in the column RE: Select Command while dropping first 2 characters in the column

  • You can use the STUFF or SUBSTRING functions as well as the RIGHT function. The SUBSTRING function version is likely to be the fastest, followed by the RIGHT version then the STUFF version.

    DECLARE @value varchar(20)

    SELECT @value = 'ks105'

    SELECT STUFF(@value, 1, 2, '') AS [Stuff],

    SUBSTRING(@value, 3, 18) AS [Substring],

    RIGHT(@value, LEN(@value) - 2) AS [Right]