Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Copying From Results to Excel

Author  Topic 

swoozie
Starting Member

25 Posts

Posted - 2014-04-01 : 11:12:04
I am having the strangest issue and cant determine how to correct it.

I am running a query. I want to copy the results set to EXCEL to email to someone. There is an address field in the data. It is a NVarchar(255) data type. It looks normal, but hen I copy the table

Fields containing these items: 100 Some Street, NW Washington, DC that look like a space but it is acting like a return and on paste it is moving the record to the next row down. I am not sue how to fix it. any ideas?

It happens with export to csv also.

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-04-01 : 17:17:46
Convert the data in the column to binary and examine one of the examples to understand what the non-printable characters are. Then you probably will have to replace those characters using a REPLACE command. You can convert to binary using this:
SELECT CONVERT(VARBINARY(510),YourAddressField) FROM YourTable;
Go to Top of Page
   

- Advertisement -