3

I am using Visual Studio 2017.

Functionality - Open Visual Studio - Go to Tools - Click SQL Server - New Data Comparison

After mentioning source and target database and running the tool, I get results - (Different Records, Identical Records)

Is there a way to export this data result to Excel?

Jacob H
  • 2,455
  • 1
  • 12
  • 29
hvirdi
  • 31
  • 1
  • 6

1 Answers1

-1

Harshit Virdi has noted he has access to Microsoft SQL Management Studio. There are two easy ways I know of to export results into Excel:

  • Option 1 the "right click on your results" option:

Run your query like normal in Microsoft SQL Management Studio. Then right click on the results like this:

enter image description here .

Choose "Save Results As..." and if you pick CSV (comma separated value) you'll be able to open that in Excel.

  • Option 2 would be to Export from a table or view directly. Right click on the database (not the table) you want to export from, choose tasks, and Export Data...:

enter image description here

  1. A wizard will appear (ha!)
  2. Choose your Data Source (SQL Native Client)
  3. Pick your server and database
  4. Choose your Destination
  5. Select Excel, and pick a path. I keep it at Excel Version 97-2003 but you can try different ones
  6. Now you can choose to either write a query or pick a table, the choice is yours!
  7. Hit next and finish it up and boom, you have your data in Excel.

The export data wizard is rather powerful, you can also transfer data between servers very fast and easily. It's a tool worth learning more about. You may have noticed on the last steps of the wizard you can save your 'code' as an SSIS package. That way you could run the same export again, or automate it. However that goes beyond the scope of this question. Good luck!

sniperd
  • 5,124
  • 6
  • 28
  • 44
  • 1
    Thank you for providing detailed answer. But in my scenario I want to export data from Visual Studio, I am using New Data Comparison functionality of Visual Studio, and I need to export results of this functionality to excel. – hvirdi Jul 23 '18 at 13:42
  • Oh, I thought you meant you could _use_ SQL Studio when you said you commented you had access. – sniperd Jul 23 '18 at 13:52
  • oops... yes I have access but I thought you'd be giving a different solution from SQL studio. Anyways thanks again, your solution may be useful in future. – hvirdi Jul 23 '18 at 14:28
  • ha, cool :) I was going to delete the answer but I'll keep it there then – sniperd Jul 23 '18 at 15:13
  • Even though the answer maybe in response to a misinterpretation of the question, the spirit of it still works - at least manually... * Click on a line of the diff results * Under the "Different Records" tab below, right click on a row > Select All * Copy * Paste into Excel – Leif Jones Oct 25 '19 at 14:14