Search

Showing posts with label Script to remove Tab. Show all posts
Showing posts with label Script to remove Tab. Show all posts

Wednesday, October 3, 2012

Script to remove Tab, Line Feed and Carriage Return from a string

The below TSQL script removes the Tab, Line feed, Carriage Return characters in a string:


SET NOCOUNT ON
DECLARE @String VARCHAR(100)
DECLARE @CorrectedString VARCHAR(100)

SELECT @String = 'ARUN    KUMAR 
LADHA'

PRINT @String

SELECT @CorrectedString = REPLACE(@CorrectedString, CHAR(13),'')
PRINT @CorrectedString

SELECT @CorrectedString = REPLACE(@CorrectedString, CHAR(10),'')
PRINT @CorrectedString

SELECT @CorrectedString = REPLACE(@String, CHAR(9),'')
PRINT @CorrectedString