How do you EXPORT query results to .txt with delimiters

  • SQL2005- I need to export data (query results, not a whole table) to a text file with ^ between data and | between records. I do not know where to begin. And if there is any T-Sql coding, please provide. The file will be called OrgFileName.txt (if that helps) Thanks in advance.

  • Personally, I'd use an SSIS flatfile export and put in a calculated column with | to add at the tail. Then use ^ as your column separator.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Did you consider BCP for this? Here is the link: http://msdn.microsoft.com/en-us/library/ms162802.aspx

    Swarndeep

    http://talksql.blogspot.com

  • BCP if you're only doing it once. SSIS (like Craig suggested) if it's going to be repeated more than 2 times.

    Don't be scared by SSIS. It's rather simple to use for jobs like this.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

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

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