[code language="sql"]
CREATE FUNCTION dbo.RemoveSpecialCharacter(@Str NVARCHAR(MAX))
RETURNS NVARCHAR(MAX)
AS
BEGIN
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
RETURN @Str
END
[/code]
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.
No comments:
Post a Comment