Export all tables of database to Excel

Proposed Answer Export all tables of database to Excel

  • Sunday, February 17, 2013 12:46 AM
     
     

    Hi to everybody

    How can I export all tables of a database to one excel file (each table should be one spreadsheet in the excel file) by using SQL Code?

    Important remarks:
    - The export should be generated via (T-)SQL Code not else how
    - The Excel File should be created by SQL Code (it does not exist in advance)
    - The tablenames are dynamic; I don't know the names in advance. Therefore the skript should dynamically read table names (using something like a for-loop)
    - I am using SQL Server 2008 R2
    - I am using MS Office 2007


    Thanks a lot for your support in advance
    Angeline


All Replies