Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$ character in SQL text breaks the deployment #121

Open
piroinno opened this issue Sep 11, 2020 · 1 comment
Open

$ character in SQL text breaks the deployment #121

piroinno opened this issue Sep 11, 2020 · 1 comment
Labels

Comments

@piroinno
Copy link

@piroinno piroinno commented Sep 11, 2020

We have observed that when we inject '$' into the SQL text and execute deploy.ps1 it fails with the following error:

[12:15:16][deploy.ps1] System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near 'master'.
Incorrect syntax near 'master'.
Incorrect syntax near ')
BEGIN
RAISERROR ('.
Incorrect syntax near '?'.
Incorrect syntax near 'master'.
Incorrect syntax near ')
BEGIN
RAISERROR ('.
Incorrect syntax near '?'.
Incorrect syntax near ')
BEGIN
RAISERROR ('.
Incorrect syntax near 'master'.
Incorrect syntax near ')
BEGIN
RAISERROR ('.
Incorrect syntax near '?'.
Incorrect syntax near 'master'.
Incorrect syntax near ')
BEGIN
RAISERROR ('.
Incorrect syntax near '?'.
Incorrect syntax near 'END'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at DbUp.Support.ScriptExecutor.ExecuteAndLogOutput(IDbCommand command)
at DbUp.SqlServer.SqlScriptExecutor.ExecuteCommandsWithinExceptionHandler(Int32 index, SqlScript script, Action excuteCommand)
ClientConnectionId:3fc63250-120c-4dcf-9e82-a961206db174
Error Number:102,State:1,Class:15

@nvarscar
Copy link
Collaborator

@nvarscar nvarscar commented Sep 13, 2020

I cannot reproduce on my end, could you please share more details?

  • Problematic SQL code
  • Version of the module (Get-Module dbops -ListAvailable)
  • Is this about DbUp variable replacement feature? (DbUp is using $variable$ syntax, which DBOps does not implement, using `#{variable} by default)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.