Showing posts with label Special Characters. Show all posts
Showing posts with label Special Characters. Show all posts

Thursday, April 5, 2018

What are the special characters in XML?

How to handle special characters in XML?

In XML, five characters are reserved for internal use and you must replace them by replacement text when they are used in data.

The following table shows the characters that must be replaced by their replacement text in XML files

XML Special Characters

Reserved Character Replacement Text
" "
' '
> >
< &lt;
& &amp;

Wednesday, March 5, 2014

How to Remove Special Characters Using SQL

Remove Special Characters Using TSQL


CREATE FUNCTION [dbo].[RemoveSpecialCharacters](@StrValue NVARCHAR(4000))
RETURNS NVARCHAR(4000)
AS
BEGIN

    Declare @KeepValues as varchar(50)

SET @StrValue = LTRIM(RTRIM(@StrValue))

    SET @KeepValues = '%[^a-z0-9]%'

    WHILE PATINDEX(@KeepValues, @StrValue) > 0
        SET @StrValue = STUFF(@StrValue, PATINDEX(@KeepValues, @StrValue), 1, '')

    Return @StrValue
END


Result:

SELECT DBO.RemoveSpecialCharacters('Welcome %To $Axil - 007')

WelcomeToAxil007