Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dwalker79
Yak Posting Veteran
54 Posts |
Posted - 2009-04-29 : 13:55:57
|
| Can someone please help me. The tu.Comment field in this query is text data type. Currently the tu.Comment field contains carriage returns and line feeds. How can I eliminate the carriage returns and line feeds from this query?SELECT vi.status , vi.stock_# , vi.client_unit_# , vi.vin , tu.Update_Date , tu.comment , tu.User_ID , ra.Recovery_ID , ra.Recovery_Agents , ra.City , ra.State , ra.ZipFrom Vehicle_Inventory vi Inner Join T_Updates tu on vi.stock_#=tu.stock_# Inner Join Update_type ut on tu.update_type=ut.Update_Nbr Inner Join Repo_Agents ra on vi.recovery_id=ra.recovery_idWhere (Datediff(d,tu.update_date,getdate())<1) And vi.customer_#='10175' and tu.update_type<>'51'Thank You! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-04-29 : 14:11:18
|
| http://www.sqlteam.com/article/search-and-replace-in-a-text-column |
 |
|
|
dwalker79
Yak Posting Veteran
54 Posts |
Posted - 2009-04-29 : 14:21:47
|
| This doesn't exactly give me what I need. I need to be able to run this exact query and eliminate the carriage returns and line feeds in the Comments field in the output. Can I use the Replace function if I somehow cast the text field to a varchar? |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2009-04-29 : 14:27:06
|
| Where are you presenting the data? Formatting should be done in your presentation layer.[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQL or How to sell Used CarsFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
dwalker79
Yak Posting Veteran
54 Posts |
Posted - 2009-04-29 : 14:32:16
|
| I checked with the application developer and they are using a .Net export application to produce the output .txt file. They wanted to see if there was a way to change this in the sql query without having to modify the format on their end. Is this possible? |
 |
|
|
dwalker79
Yak Posting Veteran
54 Posts |
Posted - 2009-04-29 : 14:55:24
|
| I think I may have figured it out with the following syntax:replace ( replace(cast(tu.Comment as varchar (8000)), char(10), ''), char(13), ' ') |
 |
|
|
|
|
|
|
|