Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

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

By Johan Bijnens,

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.

 

 

 

 

 

Total article views: 1283 | Views in the last 30 days: 4
 
Related Articles
FORUM
FORUM

How to Access Active Directory with management studio 2008

Active Directory Sql Management studio

FORUM

Licensing SQL Sever Management Studio.

Licensing SQL Sever Management Studio.

FORUM

Microsoft SQL Server Management Studio Question

Microsoft SQL Server Management Studio Question

FORUM

Registering 300+ SQL Servers to management studio from a list

Registering 300+ SQL Servers to management studio from a list

Tags
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones