Hi now we can see how to remove first / last character in a string SQL Server.
Query for remove first char
Example
DECLARE @rollid NVARCHAR(MAX)
SET @rollid=',18,24,40,'
SELECT Substring(@rollid, 2, (len(@rollid))) as Rollno
Result
18,24,40,
Query for remove last character from string
Example
DECLARE @rollid NVARCHAR(MAX)
SET @rollid='18,24,40,'
SELECT Substring(@rollid, 1, (len(@rollid)-1)) as Rollno
Result
18,24,40