sqlquantumleap / simplesqlexec Goto Github PK
View Code? Open in Web Editor NEWLightweight command-line utility to execute queries on SQL Server in place of SQLCMD
Home Page: https://SqlQuantumLeap.com/
License: Apache License 2.0
Lightweight command-line utility to execute queries on SQL Server in place of SQLCMD
Home Page: https://SqlQuantumLeap.com/
License: Apache License 2.0
I will try to write here the features that would be useful from my point of view:
I wanted to start a discussion on the viability of a .NET Core version.
Earlier this week I posted a draft PR (#16) and from the looks of it its working fine. We did a couple of tests on our build agents and noticed no issues. At the same time our migration scripts are all generated by EF Core so we dont do anything too complex or weird there.
Maybe the best way forward would be to leave both console application projects in the solution and move all functionality to a Netstandard library. That way we will keep the classic framework application for Windows/Legacy projects and the .NET Core one for Linux (and Windows).
Let me know what you think :) if you like the idea I'll go ahead and push the changes adding the library to the solution.
Kind regards!
Allow substitution of $(var_name)
variable.
This also requires handling:
-v
command-line switch:setvar
SQLCMD command-x
ignore scripting variablesThe following notes are taken from the MSDN page for the sqlcmd Utility:
Variable Precedence (Low to High)
- System-level environmental variables.
- User-level environmental variables
- Command shell (SET X=Y) set at command prompt before running sqlcmd.
- sqlcmd -v X=Y
- :Setvar X Y
NOTES:
:setvar VarName
without a value clears the variable.What license is this released under ? The MIT License (MIT)?
Example:
https://raw.githubusercontent.com/adamralph/stylecop-msbuild/master/license.txt
Add support for SQLCMD commands, such as:
:r
:Setvar
[:] RESET
[:] !!
[:] QUIT
[:] EXIT
:List
:Listvar
:Error
:Out
:Connect
:On Error
Optionally:
[:] ED
:Perftrace
:Help
:XML [ON | OFF]
Do not do these:
:Serverlist
These commands are described on the following MSDN page:
Start with :r
and :setvar
as they are the most commonly used, especially if using SSDT.
NOTES:
-X[1]
:
ED
and !!
commands1
is also specified, error and exitBy default in SQLCMD and SSMS, errors do not abort the current batch or cancel any remaining batches. The following, run in either of those, will return all four result sets:
SELECT 1;
RAISERROR('test 1', 16, 1);
SELECT 2;
GO
SELECT 3;
RAISERROR('test 2', 16, 1);
SELECT 4;
GO
Currently, SimpleSqlExec will abort at the first error. While that behavior is probably preferred, it is different than SQLCMD and SSMS. There should at least be the ability to continue after an error.
Also, emulating SQLCMD behavior requires handling the -b
"batch abort" switch which will terminate at the end of the current batch if there was an error. In the example code above, using -b
should result in getting just the 1 and 2 result sets, not 3 or 4.
Batch parsing should be able to handle the following cases:
single, single-line block comment:
/* comment */ GO
single, multiple-line block comment:
/* comment line 1
line 2
line 3 */ GO
multiple block comments (no space between them!):
/* comment line 1
line 2 *//* start of #2
*/ GO 4
batch terminator embedded in a multi-line comment should be ignored:
/* comment line 1
GO
more comments */
batch terminator embedded in a multi-line string literal should be ignored:
' some text
GO
more text'
Script to reproduce:
/*
Instructions to use this stored procedure:
exec stored_procedure arg1, arg2
go
*/
create procedure stored_procedure
-- etc
Sometimes there may be a go within a comment - most often as some kind of documentation.
These should not be recognized as a batch separator.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.