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)
 Pasting data into excel

Author  Topic 

rama108
Posting Yak Master

115 Posts

Posted - 2014-01-09 : 14:25:05
I am trying to copy the data with headers from Management studio and then pasting it into excel. The column with nVarChar(max) is messed up when pasting into the excel. How do I resolve it?
Thanks.

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2014-01-10 : 05:02:31
did you try with datatype 'Text' in that particular excel column

mohammad.javeed.ahmed@gmail.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-10 : 05:10:53
you can use bcp to export it directly to execl without using manual copy paste if you want

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

rama108
Posting Yak Master

115 Posts

Posted - 2014-01-10 : 10:05:49
It was an issue with the nVarChar column having new line characters. So i replaced the new line characters with spaces. Here is the code:
REPLACE(REPLACE(REPLACE(Description, CHAR(13) + CHAR(10), ' '), CHAR(13), ' '), CHAR(10), ' ')
Thanks.
Go to Top of Page
   

- Advertisement -