How to create spool file on SQL Server?

Posted on 2014-08-12
Last Modified: 2014-08-18
How to create spool file on sql server and what sql commands we need to set for genetrating the file?
My file contains only Id column .

Please help .
Question by:digs developer

    Author Comment

    by:digs developer
    Below is my statement . I have run this state
    sqlcmd -S -U usernam -Pdigspwd -d xyz -i sqlquery.sql -o testfile.txt  -y 8000 -h -1

    It works proper .
    Thank you !!
    LVL 76

    Accepted Solution

    Bcp is the utility to run as a t-SQl

    Are you looking for a job that will run and generate a file?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Introduced in Microsoft SQL Server 2005, the Copy Database Wizard ( is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
    Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
    Via a live example, show how to shrink a transaction log file down to a reasonable size.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now