dbcli / mssql-cli

A command-line client for SQL Server with auto-completion and syntax highlighting
BSD 3-Clause "New" or "Revised" License
1.35k stars 192 forks source link

Allow multiline query with --query (-Q) parameter #480

Open KrzysztofKarol opened 4 years ago

KrzysztofKarol commented 4 years ago

Hi!

Is it possible to run multiline query as input, e.g.:

PS> mssql-cli --integrated --server "SERVER_NAME" --query @"
>> select top 1 *
>> from $(Read-Host 'Table')
>> "@

?

Simple example:

PS> mssql-cli --integrated --server "SERVER_NAME" --query @"
>> select top 1 *
>> from TableName
>> "@
Msg 263, Level 16, State 1, Line 1
Must specify table to select from.