Red Gate forums :: View topic - Results formatting problem
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Multi Script 1
SQL Multi Script 1 forum

Results formatting problem

Search in SQL Multi Script 1 forum
Post new topic   Reply to topic
Jump to:  
Author Message
tkdennis



Joined: 29 Feb 2008
Posts: 75

PostPosted: Thu Nov 05, 2009 11:21 pm    Post subject: Results formatting problem Reply with quote

I'm running a short script that produces text with both _ and " in the results.
Code:
DECLARE @s VARCHAR(MAX), @servername sysname
SELECT @s = '', @servername = REPLACE(@@SERVERNAME, '\', '_')
SELECT @s = 'md "C:\_\SQL Compare\Servers\' + @servername + '"' + CHAR(13) + CHAR(10)
PRINT @s


If I display in Text format, the _ is converted to a -
md "C:\-\SQL Compare\Servers\SERVER1-DEV"

If I display in Grid format and copy to clipboard, the whole text is wrapped in double-quotes so every " in the result set is doubled up.

Is there a way to stop the Text display from changing all the _ to -?

Thanks,
Traci

SQL Multi Script 1.1.0.34
Back to top
View user's profile Send private message
dlkj



Joined: 14 Aug 2007
Posts: 151
Location: Red Gate Software, Cambridge

PostPosted: Fri Nov 06, 2009 12:46 pm    Post subject: Reply with quote

Hi tkdennis,

You're right, the text display is a bug. Looks like something is not getting escaped properly. I'll look into that.

The grid view is correct. As the results contains white space characters, the cell value has to be wrapped in quotes. Any quotes in the results are escaped using double quotes as well. This ensures that the output can be pasted into excel or other spreadsheet application.

A temporary work around would be to remove the new line from the end of your result string, paste the results into excel and then save the excel sheet to a text file. (Not idea, but we'll see what we can do about fixing the text output).

Cheers,
--
Daniel Kenyon-Jones
Software Engineer - DBA Tools
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group