Welcome to SqlAdvice Sign in | Join | Help

Remove Extra Spaces when Pasting from Outlook to Sql Server Management Studio

I seem to have this problem that when I paste sql code from my email into Sql Server Management Studio that it doubles all the line breaks and I have to go and remove them all.  Most of the time this isn't a big deal because the Sql is only a couple lines.  However if you get a ton of Sql emailed to you it can be quite annoying.  I finally found a way to quickly get rid of them.  Simply bring up the find and replace window and change the find to use Regular Expressions.  Then do a find on \n\n and replace that with \n. 

If anyone knows of a way to change a setting in Outlook to avoid this please let me know.

Sponsor
Published Friday, September 14, 2007 10:01 AM by gstark

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Sunday, November 25, 2007 12:31 PM by Feed Search Engine - All Fresh Articles And News Are Here

# Feed Search Engine - All Fresh Articles And News Are Here

Saturday, July 19, 2008 10:25 PM by Jonathan Starr

# re: Remove Extra Spaces when Pasting from Outlook to Sql Server Management Studio

yes, there is a way to easily remove the spaces.  If you copy the sql text to ms word first, then from ms word to sql management studio, there will be no extra spaces.  There may be a lighter weight editor that does the same thing, but I am not aware of one.

I hope this helps!

Jonathan Starr

Leave a Comment

(required) 
required 
(required) 
Enter the code you see below