0

I have a field in SQL that is called Comments I am trying to pull all comments with a "?" in them so below is a sample code like what I am using. The code works fine however the problem is when I go to copy this data out and paste it into word or excel the information comes out looking jumbled. I have figured out the reason for this is that the input side of the application where the comments are entered allows for the user to do multi-line comments so there are hard returns in the field. Is there a way I can export the data without the hard returns. I am using SSMS with a SQL 2012 database. For Office I have 2013 if that is needed.

Select C.Comment

From Patron.Comment as C

Where C.Comment like '%?%'
Chad Portman
  • 1,134
  • 4
  • 12
  • 38

1 Answers1

2

Yes, this is possible, you can use the REPLACE function to get rid of unwanted newline characters: Replace a newline in TSQL

Community
  • 1
  • 1
Glorfindel
  • 21,988
  • 13
  • 81
  • 109