HOW TO EXPORT A TABLE TO A CSV FILE --IN MS SQL SERVER 2008

  • [font="Comic Sans MS"]Hi

    Iam working on sql server and performed some queries and got required tables as results.

    Now I want to Export the table to a CSV file USING SCRIPT (only).

    help me if anyone knows.

    :w00t:[/font]

  • One option is the bcp command. This link http://technet.microsoft.com/en-us/library/ms162802.aspx gives more info.

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • sk.ruhulla (3/10/2014)


    [font="Comic Sans MS"]Hi

    Iam working on sql server and performed some queries and got required tables as results.

    Now I want to Export the table to a CSV file USING SCRIPT (only).

    help me if anyone knows.

    :w00t:[/font]

    What kind of script?

    As you're in the SSIS forum, I'm assuming that you want to use an SSIS package, is that correct?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • sk.ruhulla (3/10/2014)


    [font="Comic Sans MS"]Hi

    Iam working on sql server and performed some queries and got required tables as results.

    Now I want to Export the table to a CSV file USING SCRIPT (only).

    help me if anyone knows.

    :w00t:[/font]

    You can use BCP. But why do you want to do that way only ?

    --

    SQLBuddy

  • You don't need a script task to export a table in SSIS , chose a dataflow task within SSIS. Make ole db the source and make a flat file your destination. Have you done this before?

    ----------------------------------------------------

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

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