sql-serversqlcmd

How can I view rows vertically in SQLCMD?


In my psql I used to set \X for enabling Expanded Display and view my rows data with column names along side. Can I get this in SQLCMD as well?


Solution

  • Try sqlcmd ... -F vertical.

    Source: https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility?view=sql-server-ver16&tabs=go%2Cwindows%2Cwindows-support&pivots=cs1-bash#enhancements

    I can't comment on how far back that option goes, but it is working on the version that's currently available these days on MacOS via Homebrew:

    brew info sqlcmd
    ==> sqlcmd: stable 1.8.2 (bottled)
    Microsoft SQL Server command-line interface
    https://github.com/microsoft/go-sqlcmd