How To Prevent New Line/Carriage Return In Query Results Within SSMS

  • I realize there is porbably a term or common phrase to describe this ( something better then New LIne / Carriage Return) but I don't know what it is. The problem is that if the source data includes CHAR(10) and CHAR(13) in a VARCHAR field then when I include that field in my query where the destination is GRID then the contents of that field that come after the CHAR(10) & CHAR(13) are paced in column 1 of the next row in the grid.

    I know that CHAR(10) and CHAR(13) are both within the VARCHAR field because I;ve searched for and found them and so I can manually strip them from teh results via teh REPLACE() function but I swear that this did not use to be an issue for me with SSMS Query results. I'm also certain that the CHAR(10) and CHAR(13) have always been stored in various VARCHAR columsn of various tables of the database I work with and in the past have never caused this wrapping effect in query results.

    So why in the world are the CHAR(10) and CHAR(13) instances causing my query results to go to new rows and in the first column insetad of either not being a factor at all or wrapping to a new line within in the same row and column?

    Kindest Regards,

    Just say No to Facebook!
  • I believe your results are being returned to text and not to grid.

    To avoid that problem you could use nested REPLACE on the columns that are giving you problems.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (6/4/2013)


    I believe your results are being returned to text and not to grid.

    To avoid that problem you could use nested REPLACE on the columns that are giving you problems.

    I wish it were that easy but the results are being returned to the grid already and sure enough its wrapping the text. I take it by the lack fo replies that either this is a no bariner or something no one else has ever seen before.

    Whats really weird is that its now stopped. I just tested this again because I was going to get a screenshot, svae it and upload it and now I can no longer reproduce this text wrapping if the results are set to GRID. Man thats weird!

    Thanks

    Ed

    Kindest Regards,

    Just say No to Facebook!
  • Maybe you traveled to an alternate reality. :hehe:

    I'm glad that it's solved now (even if I didn't help). Maybe it was an issue on SSMS.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply