In my sql server 2008, after running the query the data return is very huge say in millions. I tried copying but it gives an exception sql memory error. Can you let us know how can i copy the entire data and paste it into excel.
I don't want to export it to txt file as the data is not getting aligned.
So i want to manually copy and paste it into excel.
Please let me know the solution for thhis
Best Answer
You aren't going to be able to copy and paste like you want. However you do have several options. Simplest is to right click on the output and save as a CSV file. That assumes that you don't have an commas in your text data though.
Your next option (and probably best) is to use the export wizard. Right click on your database name, then Tasks, then Export Wizard
Your source will be the database you right clicked on.
Pick an excel destination.
Select the Write a query to specify the data to transfer.
Paste in your query
You can change the sheet name in your spreadsheet here.
Next is the list of mappings for you to review
And from here you can either run the package immediately or save the SSIS package for later use/fixes. If your export doesn't work the first time and you are at all familiar with SSIS I would save the package so you can go into it and make corrections outside the wizard.
Then just hit finish and finish again.