chucknorris / roundhouse

RoundhousE is a Database Migration Utility for .NET using sql files and versioning based on source control
http://projectroundhouse.org
916 stars 249 forks source link

Version 1.0.4.0 is throwing Syntax errors on stored procedures that run fine under version 0.8.6.268 #381

Closed ghost closed 5 years ago

ghost commented 5 years ago

I've run into an issue where I receive a syntax error when deploying a stored procedure to a Microsoft SQL database with version 1.0.4.0 I am able to deploy this same stored procedure to the same server/database with SSMS and RH version 0.8.6.268 Any information as to how to start trouble shooting this issue would be appreciated. error output is included bellow.

RoundhousE encountered an error. System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near '?'. Incorrect syntax near '?'. 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.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at roundhouse.databases.AdoNetDatabase.run_command_with(String sql_to_run, ConnectionType connection_type, IList1 parameters) at Polly.Policy.<>c__DisplayClass144_0.<Execute>b__0(Context ctx, CancellationToken ct) in C:\projects\polly\src\Polly.Shared\Policy.ExecuteOverloads.cs:line 20 at Polly.RetrySyntax.<>c__DisplayClass22_1.<WaitAndRetry>b__1(Context ctx, CancellationToken ct) in C:\projects\polly\src\Polly.Shared\Retry\RetrySyntax.cs:line 488 at Polly.Retry.RetryEngine.Implementation[TResult](Func3 action, Context context, CancellationToken cancellationToken, IEnumerable1 shouldRetryExceptionPredicates, IEnumerable1 shouldRetryResultPredicates, Func1 policyStateFactory) in C:\projects\polly\src\Polly.Shared\Retry\RetryEngine.cs:line 49 at Polly.RetrySyntax.<>c__DisplayClass22_0.<WaitAndRetry>b__0(Action2 action, Context context, CancellationToken cancellationToken) in C:\projects\polly\src\Polly.Shared\Retry\RetrySyntax.cs:line 487 at Polly.Policy.ExecuteInternal(Action2 action, Context context, CancellationToken cancellationToken) in C:\projects\polly\src\Polly.Shared\Policy.cs:line 43 at Polly.Policy.Execute(Action2 action, Context context, CancellationToken cancellationToken) in C:\projects\polly\src\Polly.Shared\Policy.ExecuteOverloads.cs:line 84 at roundhouse.databases.DefaultDatabase`1.run_sql(String sql_to_run, ConnectionType connection_type) at roundhouse.migrators.DefaultDatabaseMigrator.run_sql(String sql_to_run, String script_name, Boolean run_this_script_once, Boolean run_this_script_every_time, Int64 version_id, EnvironmentSet environment_set, String repository_version, String repository_path, ConnectionType connection_type) at roundhouse.runners.RoundhouseMigrationRunner.traverse_files_and_run_sql(String directory, Int64 version_id, MigrationsFolder migration_folder, EnvironmentSet migrating_environment_set, String repository_version, ConnectionType connection_type) at roundhouse.runners.RoundhouseMigrationRunner.log_and_traverse(MigrationsFolder folder, Int64 version_id, String new_version, ConnectionType connection_type) at roundhouse.runners.RoundhouseMigrationRunner.run() ClientConnectionId:22e6c8ea-e18d-40e7-8573-c511dfe7be3a Error Number:102,State:1,Class:15 SqlErrors: Error Number: 102, Message: Incorrect syntax near '?'. Error Number: 102, Message: Incorrect syntax near '?'.

ghost commented 5 years ago

Also, there are no ? anywhere in the TSQL

ghost commented 5 years ago

Found 2 non ASCII white space character in the TSQL as soon as I removed them, the stored proc deployed fine under version 1.0.4.0.