{"action":"created","issue":{"url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/271","repository_url":"https://api.github.com/repos/sqlcollaborative/dbatools","labels_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/271/labels{/name}","comments_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/271/comments","events_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/271/events","html_url":"https://github.com/sqlcollaborative/dbatools/issues/271","id":183682012,"number":271,"title":"copy-sqlLogin error","user":{"login":"dczarny","id":22891890,"avatar_url":"https://avatars.githubusercontent.com/u/22891890?v=3","gravatar_id":"","url":"https://api.github.com/users/dczarny","html_url":"https://github.com/dczarny","followers_url":"https://api.github.com/users/dczarny/followers","following_url":"https://api.github.com/users/dczarny/following{/other_user}","gists_url":"https://api.github.com/users/dczarny/gists{/gist_id}","starred_url":"https://api.github.com/users/dczarny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dczarny/subscriptions","organizations_url":"https://api.github.com/users/dczarny/orgs","repos_url":"https://api.github.com/users/dczarny/repos","events_url":"https://api.github.com/users/dczarny/events{/privacy}","received_events_url":"https://api.github.com/users/dczarny/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-18T13:11:14Z","updated_at":"2016-10-21T23:14:53Z","closed_at":"2016-10-21T23:14:53Z","body":"I found an error with the Copy-SqlLogin.ps1 that is causing me some problems copying SQL Logins from SQL Server 2000 to 2008R2.  After looking at it, on linke 285 where the $sqlfailsafe variable is building a string to create the login, there is another variable reference $language.  I don't see that variable created or referenced anywhere else in the code.  This is the error I am receiving.  When I hard code the $language variable to English, my error goes away.\r\n\r\nC:\\Users\\dczarny\\Documents\\WindowsPowerShell\\Modules\\dbatools\\functions\\Copy-SqlLogin.ps1\r\nAt C:\\Users\\dczarny\\Documents\\WindowsPowerShell\\Modules\\dbatools\\functions\\Copy-SqlLogin.ps1:287 char:9\r\n+                                 $null = $destserver.ConnectionContext.ExecuteNonQuery($sqlfailsafe)\r\n+                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nSystem.Management.Automation.MethodInvocationException: Exception calling \"ExecuteNonQuery\" with \"1\" argument(s): \"An exception occurred while executing a Transact-SQL statement or batch.\" ---> Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch. ---> System.Data.SqlClient.SqlException: An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as \"\" or [] are not allowed. Change the alias to a valid name.\r\n   at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)\r\n   at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)\r\n   --- End of inner exception stack trace ---\r\n   at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)\r\n   at CallSite.Target(Closure , CallSite , Object , Object )\r\n   --- End of inner exception stack trace ---\r\n   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)\r\n   at lambda_method(Closure , Object[] , StrongBox`1[] , InterpretedFrame )"},"comment":{"url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/comments/255486857","html_url":"https://github.com/sqlcollaborative/dbatools/issues/271#issuecomment-255486857","issue_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/271","id":255486857,"user":{"login":"ConstantineK","id":6138430,"avatar_url":"https://avatars.githubusercontent.com/u/6138430?v=3","gravatar_id":"","url":"https://api.github.com/users/ConstantineK","html_url":"https://github.com/ConstantineK","followers_url":"https://api.github.com/users/ConstantineK/followers","following_url":"https://api.github.com/users/ConstantineK/following{/other_user}","gists_url":"https://api.github.com/users/ConstantineK/gists{/gist_id}","starred_url":"https://api.github.com/users/ConstantineK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ConstantineK/subscriptions","organizations_url":"https://api.github.com/users/ConstantineK/orgs","repos_url":"https://api.github.com/users/ConstantineK/repos","events_url":"https://api.github.com/users/ConstantineK/events{/privacy}","received_events_url":"https://api.github.com/users/ConstantineK/received_events","type":"User","site_admin":false},"created_at":"2016-10-21T23:14:53Z","updated_at":"2016-10-21T23:14:53Z","body":"Talked to @dczarny in slack, looks like this issue may have arisen due to some side effects, after updating it went away. Going to look at the other login issues. "}}
{"actor":{"display_login":"ConstantineK"}}