'Copy with Headers' in SQL Query Result not working

Malam Malam 226 Reputation points
2022-10-19T13:26:09.847+00:00

I am trying to copy query result "Copy with Headers" so I can paste in Excel.
When I "Copy with Headers" and paste in Excel; the entire pasted data is in Excel looks weird. The Headers are in one single column and the data look even worst. Some Excel columns have multiple SQL columns and some OK. I never had this issue before, it just started to happen.

Has anyone else had this issue?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,117 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,583 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 104.2K Reputation points MVP
    2022-10-19T21:28:18.193+00:00

    Try running Azure Data Studio, and see if you have the same issue. (ADS is bundled with SSMS 18, so you should have it.)

    Another way to load data to Excel is to do it from Excel. Go to the Data Tab in the ribbon and select Get Data. This is overall a more robust way to load data into Excel, since Excel gets type information. When you copy and passed, it runs a guessing game which does not always go well.

    0 comments No comments

  2. YufeiShao-msft 7,076 Reputation points
    2022-10-20T09:15:05.923+00:00

    Hi @Malam Malam ,

    There may even be problems copying data because of a symbol, the cause of the error may be difficult to troubleshoot
    You also can choose using the SQL Server Import and Export wizard to export data,
    right-click on database>task>export data, you can export to excel

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments