Home Dashboard Directory Help
Search

Copy and paste from SQL 2012 to Excel breaks rows if an address is included by John ST


Status: 

Closed


1
0
Sign in
to vote
Type: Bug
ID: 788463
Opened: 5/23/2013 12:24:49 AM
Access Restriction: Public
1
Workaround(s)
view
1
User(s) can reproduce this bug

Description


When a result set in SQL Server 2012 Management Studio is copied and pasted into Excel (2013 and 2007, not tested other versions) any addresses in the result set are split into multiple rows with the first part of the address in the 'correct' column and all subsequent parts in column A.

While formatting an address in a single cell would be a useful optional feature the current arrangement renders the results effectively unusable without significant manipulation.

The server being connected to is a 2005 instence
the desktop is running SQL Server standard edition client tools under Windows 7 Enterprise SP1 32 bit
Details
Sign in to post a comment.
Posted by Microsoft on 5/24/2013 at 10:26 AM
Hello John. Based on the current workaround status for this issue, we will be marking it as resolved. If anyone finds the workaround does not function, please post here and we will reactivate the item. -Walter A Jokiel, Program Manager, SQL Server (wajokiel@microsoft.com)
Posted by John ST on 5/24/2013 at 12:57 AM
Morning Charles,
Thanks for getting back to be, I can confirm that the field in question does have new-line characters I will copy your workaround here for anybody who finds this feedback rather than the very similar one.

John
Posted by Microsoft on 5/23/2013 at 10:49 AM
Hello John,

Do these address fields contain any newline characters in them? If so it's likely the same issue as described in the comments of http://connect.microsoft.com/SQLServer/feedback/details/735714/sql-management-studio-output-copy-and-paste-or-save-to-csv-gives-unexpected-results, could you verify this?

Thanks,
Charles Gagnon (chgagnon@microsoft.com)
Posted by Microsoft on 5/23/2013 at 9:38 AM
Hello John. Thank you for bringing this to our attention. We really do appreciate the feedback. We’ll investigate and get back to you. -Walter A Jokiel, Program Manager, SQL Server (wajokiel@microsoft.com)
Sign in to post a workaround.
Posted by John ST on 5/24/2013 at 1:00 AM
posted from Posted by Charles Gagnon of Microsoft on 5/23/2013 at 3:58 PM on the very similar issue http://connect.microsoft.com/SQLServer/feedback/details/735714/sql-management-studio-output-copy-and-paste-or-save-to-csv-gives-unexpected-results

The REPLACE function can be used to strip the newline control characters from returned data. Example:

--This will strip the carriage return and line feed chars
--from the data in the MyCol column.
SELECT REPLACE(REPLACE(MyCol, CHAR(10), ''), CHAR(13), '')
FROM MyTable