SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

How to handle lost LF/CR when copying [code]

By Johan Bijnens, 2007/11/27

Total article views: 1178 | Views in the last 30 days: 3

I like the tagging options and forums that came with the new SSC site. There is however one little downside when scripts are tagged within code ..... /code tags.


In one of the replies I did in the forums, I copied code from management studio and pasted it between code-tags.
Another participant copied my code from the forum and pasted it back into management studio.
He ended up with one line of code because linefeeds are not handled by management studio.



For small scripts, that may not be an issue.

With larger scripts, that may cause some of us losing precious time to get the script back to a runnable state. Maybe even aborting the test effort, and that's a shame.

A simple workaround is using a texteditor like MS Word.

Paste the code into a new word document.

Result: (if you show hiden characters)

Solution:

Replace (ctrl-H) ^l to ^p (replace all, mind you)

If you use Paste Special and paste unformatted text you can even skip the replace step !

Result: (if you show hiden characters)

Copy the code from the word document to your SSMS query pane and off you go.

 

 

 

 

 

By Johan Bijnens, 2007/11/27

Total article views: 1178 | Views in the last 30 days: 3
Your response
 
 
Related tags
 
Related content

RSS Everywhere

(not yet rated) | 794 reads

Time Zone Notes

(not yet rated) | 183 reads
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com