In this article I am going to explain how to remove the special characters like coma (,), hyphen (-), underscore (_) from string using Sql server.
In the previous article I have explained how to create tags using Jquery inasp.net, how to set color for ODD and EVEN rows in HTML Table using CSS, Sort andfilter Grid using AngularJs in MVC and Form validation example using AngularJswith Bootstrap in MVC application.
To remove the special characters from string I am using the REPLACE function of sql server.
I have created a table and insert some dummy record into it.
I want to remove the.,_,- from student name and username. Here is the SQL query to get student and username without special characters.
SELECT REPLACE(replace(StName,'.',' '),'_',' ') AS [Student Name],
replace(replace(replace(StUsername,'_',' '),'-',' '),'.',' ') as [username]
What do you think about this article?
If you found this article useful, please share and follow on Facebook, Twitter, Google Plus and other social media websites. To get free updates subscribe to newsletter. Please put your thoughts and feedback in comments section.