{"id":1958,"date":"2015-04-09T11:17:00","date_gmt":"2015-04-09T11:17:00","guid":{"rendered":"http:\/\/galhano.com\/blog\/?p=1958"},"modified":"2015-04-09T11:27:30","modified_gmt":"2015-04-09T11:27:30","slug":"sql-server-fix-error-15023-user-already-exists-in-current-database","status":"publish","type":"post","link":"http:\/\/galhano.com\/blog\/?p=1958","title":{"rendered":"SQL SERVER \u2013 FIX : Error 15023: User already exists in current database."},"content":{"rendered":"<p>Error 15023: User already exists in current database.<\/p>\n<p>1) This is the best Solution.<\/p>\n<p>First of all run following T-SQL Query in Query Analyzer. This will return all the existing users in database in result pan.<\/p>\n<p>[sql]<br \/>\nUSE YourDB<br \/>\nGO<br \/>\nEXEC sp_change_users_login &#8216;Report&#8217;<br \/>\nGO<br \/>\n[\/sql]<\/p>\n<p>Run following T-SQL Query in Query Analyzer to associate login with the username. \u2018Auto_Fix\u2019 attribute will create the user in SQL Server instance if it does not exist. In following example \u2018ColdFusion\u2019 is UserName, \u2018cf\u2019 is Password. Auto-Fix links a user entry in the sysusers table in the current database to a login of the same name in sysxlogins.<\/p>\n<p>[sql]<br \/>\nUSE YourDB<br \/>\nGO<br \/>\nEXEC sp_change_users_login &#8216;Auto_Fix&#8217;, &#8216;ColdFusion&#8217;, NULL, &#8216;cf&#8217;<br \/>\nGO<br \/>\n[\/sql]<\/p>\n<p>Run following T-SQL Query in Query Analyzer to associate login with the username. \u2018Update_One\u2019 links the specified user in the current database to login. login must already exist. user and login must be specified. password must be NULL or not specified<\/p>\n<p>[sql]<br \/>\nUSE YourDB<br \/>\nGO<br \/>\nEXEC sp_change_users_login &#8216;update_one&#8217;, &#8216;ColdFusion&#8217;, &#8216;ColdFusion&#8217;<br \/>\nGO<br \/>\n[\/sql]<\/p>\n<p>more details in <a href=\"http:\/\/blog.sqlauthority.com\/2007\/02\/15\/sql-server-fix-error-15023-user-already-exists-in-current-database\/\">http:\/\/blog.sqlauthority.com\/2007\/02\/15\/sql-server-fix-error-15023-user-already-exists-in-current-database\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Error 15023: User already exists in current database. 1) This is the best Solution. First of all run following T-SQL Query in Query Analyzer. This will return all the existing users in database in result pan. [sql] USE YourDB GO EXEC sp_change_users_login &#8216;Report&#8217; GO [\/sql] Run following T-SQL Query in Query Analyzer to associate login [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"close","ping_status":"close","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,104],"tags":[],"class_list":["post-1958","post","type-post","status-publish","format-standard","hentry","category-sql-server","category-transact-sql","author-admin"],"_links":{"self":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1958","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1958"}],"version-history":[{"count":3,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1958\/revisions"}],"predecessor-version":[{"id":1961,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1958\/revisions\/1961"}],"wp:attachment":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1958"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}