Solved

SQL 2005 String Functions

Posted on 2008-10-31
2
1,204 Views
Last Modified: 2012-05-05
Hi there,
I need to detect the presence of linefeed/new line characters in a string I'm parsing in SQL 2005.

The string is of the format ~1000~3483923~893493~...~A~Temp~End
The elements are split by the delimiter and inserted in a table. Sometimes, the string contains newline characters in the middle of numbers which SQL parses and returns as 599.3 233 with a space in between

trying REPLACE(Element,' ','') does not work because SQL still recognises it as a newline and not a space. Does anyone know what is to be specified in the REPLACE function?

Thanks,
0
Comment
Question by:Ignis2000
2 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 250 total points
ID: 22850267
try this:

replace(REPLACE(Element,char(10),''), char(13), '')
0
 

Author Closing Comment

by:Ignis2000
ID: 31512043
Great stuff!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question