473,386 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

REPLACE Statement

benchpolo
142 100+
SQL Query
SELECT mh.hpcode
, ISNULL(CONVERT(varchar,mh.opfromdt,112),'') as opfromdt
, ISNULL(CONVERT(varchar,mh.opthrudt,112),'') as opthrudt
, mc.patid
, mc.membid
, mc.lastnm
, mc.firstnm
, ISNULL(mc.mi,'') as 'mi'
, REPLACE(mc.street,char(10),'')as 'address'
, mc.city
, mc.state
, mc.zip
, mc.subssn as 'subscriberid'
, mc.ez_dbname as 'company'
, mh.currhist
, ISNULL(CONVERT(varchar,mc.birth,112),'') as 'birth'
FROM memb_hphists mh
LEFT JOIN rvs_memb_company mc
ON (mh.memb_keyid=mc.memb_keyid) and (mc.EZ_dbname=mh.EZ_dbname)
WHERE mh.EZ_history IS NULL
AND mh.EZ_dbname <> 'DCRFK'
AND mc.membid IS NOT NULL
AND mh.currhist = 'C'

Issue
I have a sql above that extract data to a text file from one of our database. The problem im having is that several records have either a line feed or a carriage return. Is there a way to do a nested REPLACE query to eliminate either line feed or carriage return.
Nov 15 '07 #1
1 1598
iburyak
1,017 Expert 512MB
Try this:

Expand|Select|Wrap|Line Numbers
  1. replace(replace(column_name, char(13), ''), char(10),'')
Good Luck.
Nov 15 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Craig Keightley | last post by:
Can these lines of sql statements be consolidated into one sql statement (possibly using reg exps??) BEGIN CODE ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Update...
8
by: middletree | last post by:
What's wrong with this code? strLongDesc = Replace(Replace(Replace(Replace(Trim(Request.Form("LongDesc")),"'","''"),vbC rLf,"<br>"),"<",&lt;),"<",&gt;) Background: This field is a textarea, and I...
1
by: eddie wang | last post by:
I try to replace the following STATEMENT ONE with STATEMENT TWO. But it doesn't work. How to make it work??? Thanks. STATEMENT ONE: <td colspan="10" align="center"><a...
9
by: Richard Gutery | last post by:
I have this piece of code in an ASP page: replace (strRootDir, "\", "/", -1) When I run the script I get: Microsoft VBScript compilation (0x800A0414) Cannot use parentheses when calling a Sub ...
2
by: Little PussyCat | last post by:
Hello, I need to be able to replace only the first occurance of a space character in a column. Reason being is the data in the column I am trying to replace seems to have umpteen space...
2
by: bj daniels | last post by:
I am not certain which group to post this to - sorry if this is the wrong group: I have a table that holds the location of various media and such (mostly images). One field is the Media name,...
3
by: Andy Sutorius | last post by:
Hi, I read the thread (2/16/05) regarding a replace function in C# however it didn't answer my question. I have a string which is building an insert sql statement and I would like to replace...
8
by: Guy | last post by:
Hi, I'm trying to run this code : strFileContentsHTML.Replace(vbLf, "<br>") strFileContentsHTML.Replace(vbCrLf, "<br>") strFileContentsHTML.Replace(vbCr, "<br>") It doesn't replace newline...
2
by: Curtiosity | last post by:
I have done a create or replace view called creditcard1. If I do a "select * from creditcard1" it retrieves the data just fine. If I try to do a statement where I am listing the column names it...
2
by: Jeremy | last post by:
I am trying to replace a string "P" with "\P" as long as the string "P" does not already have a "\" in front. for my search string I've used @"(P)" so my regex replace statement is: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.