Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find carriage return in a varchar2

Status
Not open for further replies.

zapster

Programmer
Jun 8, 2001
36
GB
Hi,

How can i find out if there are carriage returns in a varchar2, with sql?

thanks
 
Zapster

Use This:
select ThatColumn
from ThatTable
where instr(ThatColumn,chr(13))>0;

Did it work? :)
 
When I try it, I get:
Server: Msg 195, Level 15, State 10, Line 3
'chr' is not a recognized function name.

Another way to find it is
select * from tablename
where columnname like '%
%'

The % are on different lines to capture the hard return. I need to replace the hard returns in my varchar column with a space. Any advice on doing that?
 
In MS SQL Server you could use the CHARINDEX(), CHAR() and STUFF() functions. See Books Online.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top