Here ‘m going to remove 3 letter / character from the given string. You can consider any number of letter to remove.
When i came to need it, i searched a lot. Yes Ofcourse i got lot of answers in many logic way. But among all the answers finally i got this solution as very easy to understand & easy to fix. its just a small piece of code to put in b/w query.
Let us see…
— Remove last 3 letter from the String
DECLARE @String VARCHAR(50)
SET @String = ‘TESTSTRING123AB’
— Chop off the end character
SET @String = LEFT(@String, LEN(@String) – 3) — can specify any number
SELECT @String AS Result
Please let me know, if you have any questions….
Happy Coding…
Tagged: .Net, Character, Database, Last, Letter, Query, Remove, SQL, SQL Query, SQL Server, String
Leave a comment