Last post Dec 16, 2019 02:31 AM by samwu
Dec 13, 2019 05:45 AM|jsshivalik|LINK
I want to remove special characters from a string and then compare with other values
Dec 13, 2019 08:25 AM|wmec|LINK
Try with Replace like
SELECT REPLACE('SQL Tutorial', 'T', 'M');
Dec 16, 2019 02:31 AM|samwu|LINK
I want to remove special characters from a string
When you ask a question, please describe your requirement in detail.
Do you want to remove special characters from strings in the sql, or is it just a C # question?
If in the sql, you can try to use the REPLACE() Function.
DECLARE @email VARCHAR(55) = 'johndoe@a!b#c.com$';
SELECT REPLACE(REPLACE(REPLACE(@email, '!', ''), '#', ''), '$', '');
If in the C#, you can try to use Regex.Replace() function.
Regex.Replace("sam%&wu", @"[^0-9a-zA-Z]+", "");
compare with other values
How do you want to compare these two values?
In the Sql. The STRCMP() function compares two strings. If string1 = string2, this function returns 0 If string1 < string2, this function returns -1, else returns 1.
More information about STRCMP() function you can refer to below link: