Export tables to textfiles with columnnames in TSQL query !

  • Hi all,

    My question are how can I export tables to textfiles from SQL Query analyzer?

    I tried the bcp utility but it can't get the columnames out ?

    In this case I want to export tables to textfiles as semicolon with quotes, how can i do that ?

     

    Help please 🙂

    Hamada

  • You may fare better using DTS from Enterprise Manager.

    In enterprise manager, choose Tools -> Data Transformation Services -> Export Data. 

    Follow the prompts, and you can name target type, separator of semicolon, etc.

     

    HTH

     

    Jonathan

     

  • In Query Analyzer, choose <Query>, <Results to File> from the Menu. Then run youe query in analyzer and point to or name a new text file to send the data to.

  • Thanks for the answers.

    But the problem is we are talking about 79 tables, and I don't want to do that 79 times???

    I want to create a script so it can run automaticly, cause I have to do it every month 🙂

    aem

  • do u mean you have to back-up our 79 tables structure, every month? do you want the table structure, or just the tables names in one text file seperated by a semi-colon?

    have you tried to execute a combination of sp and xp_cmdshell

     

     

  • Hi again,

    Yes I want to export 79 tables from the same database to 79 textfiles in the same folder in SQL query analyser. The textfiles format I want it as semicollon with quotes.

    How can I do that ?

    And I don't need to create a package because i use difference server versions.

     

    aem

     

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply