Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2002
    Location
    Southern California
    Posts
    35

    Question Unanswered: Comma Separated Output with .TXT extension

    I have a somewhat strange situation where I need the output of a query thrown into a file with a .txt extension but I need the data in comma separate form. Any idea how I would get this accomplished?

    Thanks in Advance,
    TechRick

  2. #2
    Join Date
    Apr 2002
    Location
    Sunnyvale, CA USA
    Posts
    78
    If you use bcp (from the command-line) you can specify the full filename

    - Andy Abel

  3. #3
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    You could use DTS. The fast way would be to choose the DTS Import/Export Wizard from the menu. Choose your source, then set your destination as a text file. Third select Query as your copy type, then input your query. Set your delimitor to be commas on the next screen. Then run, about 7 clicks to do.
    You can also save the package to run again or edit it in DTS.
    MCDBA

  4. #4
    Join Date
    Aug 2002
    Location
    Southern California
    Posts
    35

    Post

    Originally posted by achorozy
    You could use DTS. The fast way would be to choose the DTS Import/Export Wizard from the menu. Choose your source, then set your destination as a text file. Third select Query as your copy type, then input your query. Set your delimitor to be commas on the next screen. Then run, about 7 clicks to do.
    You can also save the package to run again or edit it in DTS.
    Thanks so much for the info. I'm giving it a go but I'm running into an error. Perhaps you or someone else might know how to fix it.

    Upon running the package I get this error: "Incomplete File Format Information - File Cannot Be Opened."

    I don't know if this has anything to do with it, but I had to jimmy-rig the package to build it. I am using 3 temporary tables and 4 views in my query. DTS would not let me finish the package unless the main temporary table was already created. So, instead of having the query build it I just have the query delete and recreate it at the end so it is blank.

    Any additional help would be appreciated.

    TechRick

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    Can you post the dts package ? Also, which version of sql server are you using - including service pack ?

  6. #6
    Join Date
    Aug 2002
    Location
    Southern California
    Posts
    35
    Originally posted by rnealejr
    Can you post the dts package ? Also, which version of sql server are you using - including service pack ?
    I am running 8.00.384 SP1 I believe.

    Anyway, I was able to work it out by breaking the task up into smaller steps and running some of them through the job scheduler. I just had the last step run under the DTS package so I could get the output I wanted.

    I had to break it up because I always seem to be above the 3200 charater limit for my queries to run as a job. Either my queries are too long or the job scheduler doesn't give enough characters...


    Thanks for your assistance.

    TechRick

Posting Permissions

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