transfer sql query output to text file

  • hi,

    Please tell how to transfer sql query output to text file. only using sql query.

  • pkuchaliya (8/5/2008)


    hi,

    Please tell how to transfer sql query output to text file. only using sql query.

    Could you describe what you would like to do in more details? SQL is not really meant to do anything with files, so "using sql" query will not really help. You can use utilities that are shipped with SQL Server to write results to files. A few:

    * bcp (you can specify an SQL query, and the result will be written to a file)

    * sqlcmd (you can redirect its output to a file, and the query result will be written to a file instead of the screen)

    * use whatever UI you are using now, and copy/paste to output to a file

    ...

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • In Query Analyzer/SQL Management Studio you can output the results directly to a file (Query menu).

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

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