sqlcmd question

  • I need to pull a few lines of data from my company's ms sql server 2012 and put it into a text file. I'm a beginner with sql servers and sql in general. I installed sqlcmd and I'm trying to play around with it. Once I connect to the sql server with sqlcmd, it's possible to do what I'm saying right? thanks!!

  • shane.corley (4/8/2016)


    I need to pull a few lines of data from my company's ms sql server 2012 and put it into a text file. I'm a beginner with sql servers and sql in general. I installed sqlcmd and I'm trying to play around with it. Once I connect to the sql server with sqlcmd, it's possible to do what I'm saying right? thanks!!

    The -o option will get your started. You may need a couple of other options like -h-1 and -s.

    The following link is the BOL entry for 2012 SQLCMD.

    https://msdn.microsoft.com/en-us/library/ms162773(v=sql.110).aspx

    The following Google page will provide some additional hints.

    https://www.google.com/?gws_rd=ssl#q=sqlcmd+write+to+text+file

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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