Remove special characters (-, _,) from string in SQL SERVER | ASPMANTRA | Asp.Net,MVC,AngularJs,Jquery,Javascript,Sql Server AND WCF snippets and tutorial

Remove special characters (-, _,) from string in SQL SERVER

In this article I am going to explain how to remove the special characters like coma (,), hyphen (-), underscore (_) from string using Sql server.



Implementation:

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.


Remove special characters (-, _,) from string in SQL SERVER


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]
FROM Tb_Student

OUTPUT:


Remove special characters (-, _,) from string in SQL SERVER

Post a Comment

[blogger]

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget