SQL Flow Field Guide

sqlcmd client commands

17 reference entries

  • :!!

    Run a command through the client operating system shell.

  • :Connect

    Open a connection to another SQL Server instance.

  • :ED

    Open the batch in the configured Windows editor.

  • :Error

    Route sqlcmd messages sent to the error stream.

  • :EXIT

    End the client and optionally return a value calculated by SQL Server.

  • :Help

    Show commands recognized by the client.

  • :List

    Show the statements waiting in the client buffer.

  • :Listvar

    List the scripting variables visible to sqlcmd.

  • :On Error

    Choose whether a script continues after an error.

  • :Out

    Choose the destination for query results.

  • :Perftrace

    Choose where sqlcmd sends its performance trace output.

  • :QUIT

    Exit the sqlcmd client.

  • :r

    Read additional SQL into a sqlcmd script.

  • :RESET

    Clear the statements waiting in the client buffer.

  • :ServerList

    List SQL Server instances discovered by the client.

  • :Setvar

    Set a text value used by sqlcmd script substitution.

  • :XML

    Switch the client's XML output mode.