DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2006

    Export select distinct into sheets in excel


    I'm looking for a functionality where i can export data from a database into excel where each select distinct result should be written into a separate tab.

    I have 74 distinct numbers from :

    select distinct(nr) from table;


    The records for nr 1 should be written to sheet 1
    The records for nr 2 should be written to sheet 2

    and so on.

    How would that be done?

    Best regards,


  2. #2
    Join Date
    Nov 2000
    Pittsburgh, PA
    You probably want to use .NET to create the spreadsheet. Or maybe VBA within Excel.
    I can't imagine that anything else is going to interface with Excel and create the files
    the way you want.
    this space intentionally left blank

  3. #3
    Join Date
    Mar 2007
    Ft. Lauderdale, FL
    May be a two steps process... first spool out "csv" files with the output of the queries, then importing them into Excel.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

  4. #4
    Join Date
    Jul 2002
    Lake Worth, FL


    Quote Originally Posted by Vestlink View Post
    . . . E t c . . .
    and so on.

    How would that be done?
    Your requirements are incomplete, please post a working test case:
    - create table
    - insert statements
    - the result you want with these data
    - Explain with words and sentences the rules that lead to this result
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.