Thursday, August 30, 2012

How do you transfer or export SQL Server 2005 data to Excel

Option 1:
  1. Right-click the database in SQL Management Studio
  2. Go to Tasks and then Export data, you'll then see an easy to use wizard.
  3. Your database will be the source, you can enter your SQL query
  4. Choose Excel as the target
  5. Run it at end of wizard

If you wanted, you could save the SSIS package as well (there's an option at the end of the wizard) so that you can do it on a schedule or something (and even open and modify to add more functionality if needed).


Option 2:

  1. Select menu item Query > Query Options.
  2. Set check box in Results > Grid > Include column headers when copying or saving the results.

After that, when you Select All and Copy the query results, you can paste them to Excel, and the column headers will be present.


Option3:

  1. Open Excel Data>Import/Export Data>Import Data Next to file name
  2. Click "New Source" Button On Welcome to the Data Connection Wizard,
  3. Choose Microsoft SQL Server. Click Next.
  4. Enter Server Name and Credentials.
  5. From the drop down box, choose whichever database holds the table you need.
  6. Select your table then Next.....
  7. Enter a Description if you'd like and click Finish.

When your done and back in Excel, just click "OK" Easy.

No comments: