microsoft / mssql-scripter

Repository for the new SQL cross-platform command line tools
Other
745 stars 150 forks source link

database name with dash will break the script #206

Open zhuominchen opened 6 years ago

zhuominchen commented 6 years ago

Sample on linux

mssql-scripter -S XXXXXX -U XXX -PXXX -d spectrum-dev Scripting request: 9b8b4136-d806-4839-b220-e20b626565c6 encountered error: Set Database failed. Error details: Microsoft.SqlServer.Management.Smo.FailedOperationException: Set Database failed. ---> System.ArgumentNullException: Value cannot be null. Parameter name: database --- End of inner exception stack trace --- at Microsoft.SqlServer.Management.Smo.TransferBase.SetDatabase(Database database) at Microsoft.SqlServer.Management.Smo.Transfer..ctor(Database database) at Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptGenerator.GetTransfer() at Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptGenerator.GetUrnList() at Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptPublishModel.GenerateScript(ScriptOutputOptions outputOptions) at Microsoft.SqlTools.ServiceLayer.Scripting.ScriptingScriptOperation.Execute() in D:\repos\sqltoolsservice\src\Microsoft.SqlTools.ServiceLayer\Scripting\ScriptingScriptOperation.cs:line 64

mvanholsteijn commented 2 years ago

This is really a problem. Even a database name with an _ breaks the login with the same error. When I change the database to msdb everything works fine. Given the fact that this problem exists for over 4 years, does not inspire trust that anybody is going to fix this soon.