T-SQL to Text File How to?

  • I need to run a query each night extract data to a text file (.txt or .csv) to ftp to a vendor.  Any ideas on how to do this?  I have seen scrips that go to Word or Excel

     

  • Scheduled DTS package would work for this.

    You'd need 2 connection objects (SqlServer and Text File) and a single transform data task. The Transform Data Task lets you enter a SQL query as the data source.

     

  • You could just create a DTS package for it! In DTS you have the option of storing a result set to a text or csv file!


    Kindest Regards,

  • If you want something a little more low-tech, there's good old osql at the command line. You can pass it a query and specify delimiters, etc. Use the -w switch to keep it from wrapping lines, which will cause annoyance.

    That said, DTS is nice.

     


    Chris Hofland

Viewing 4 posts - 1 through 3 (of 3 total)

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