Remove Carriage Return, Line Feed and Tab characters in T-SQL.
REPLACE(REPLACE(REPLACE(Field, CHAR(10), ''), CHAR(13), ''), CHAR(9), '')
Showing posts with label Replace. Show all posts
Showing posts with label Replace. Show all posts
Monday, 22 March 2010
Monday, 7 December 2009
Find and replace - SQL
UPDATE tablename
SET columnname = Replace(columnname, 'Find value', 'Replace value')
SET columnname = Replace(columnname, 'Find value', 'Replace value')
Thursday, 22 October 2009
Condensing large character string and removing carriage returns - SSRS
***Update ***
Function created:
for condensing a large character string and removing any carriage returns (such as in a comments field).
Function shortcomment(byval commentstring as string, stringlength as integer) as string
if commentstring="" or isnothing(commentstring)
return commentstring
else
commentstring=replace(commentstring, chr(10)," ")
if commentstring.length >stringlengthcommentstring=left(commentstring, stringlength) & "....."
return commentstring
else
return commentstring
end if
end if
end function
to implement:
=code.shortcomment(Fields!comments.Value, 10)
where 10 is the condensed length
Function created:
for condensing a large character string and removing any carriage returns (such as in a comments field).
Function shortcomment(byval commentstring as string, stringlength as integer) as string
if commentstring="" or isnothing(commentstring)
return commentstring
else
commentstring=replace(commentstring, chr(10)," ")
if commentstring.length >stringlengthcommentstring=left(commentstring, stringlength) & "....."
return commentstring
else
return commentstring
end if
end if
end function
to implement:
=code.shortcomment(Fields!comments.Value, 10)
where 10 is the condensed length
Labels:
Carriage Return,
CHR(10),
Condensing,
Function,
Left,
Length,
remove,
Replace,
SSRS
Thursday, 15 October 2009
Condensing large character string and removing carriage returns - SSRS
Useful formula for condensing a large character string and removing any carriage returns (such as in a comments field).
=iif(len(Replace((Fields!Comments.Value),CHR(10)," "))>25, (left(Replace((Fields!Comments.Value),CHR(10)," "),25) & "....."),Fields!Comments.Value)
...next stage will be to create a function...
http://sqlreportingservicescrystalreports.blogspot.com/2009/10/condensing-large-character-string-and_22.html
=iif(len(Replace((Fields!Comments.Value),CHR(10)," "))>25, (left(Replace((Fields!Comments.Value),CHR(10)," "),25) & "....."),Fields!Comments.Value)
...next stage will be to create a function...
http://sqlreportingservicescrystalreports.blogspot.com/2009/10/condensing-large-character-string-and_22.html
Subscribe to:
Posts (Atom)