SSIS and Sql Server Journey

Personal Notes of Sarabjit Singh and Bhavpreet Singh

Function to replace all special characters – Sql Sever

on March 19, 2012
CREATE FUNCTION dbo.RemoveSpecialCharacter(@Str NVARCHAR(MAX))

	SET @Str = Replace(@str, Char(13), ' ')
--replace all enters with space
	SET @Str = Replace(@str, Char(9), ' ')
--replace all tabs with space
	SET @Str = Replace(@str, Char(10), ' ')
--replace all line feeds with space



Useful function to be used for data export to excel sheet(Using SSIS) as the “Enter” makes the data to move to next line and the reports gets distoreted.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: