Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tried Tasks>Generate Scripts... and set 'Script Logins' in the Advanced Scripting Options, but I get this in the output:

/* For security reasons the login is created disabled and with a random password. */

Is there a simple way to script these logins with passwords or another way to transfer logins from a 2008R2 instance to a 2014 instance?

share|improve this question
4… (just ignore the mirroring references - this works for moving any logins between any instances). – Aaron Bertrand Apr 19 '14 at 17:27
@Aaron that looks very nice at first glance, thanks. – Jack Douglas Apr 19 '14 at 17:31
@Aaron I ended up using this which is basically the same thing. Thanks for pointing me in the right direction. – Jack Douglas Apr 19 '14 at 21:33

In order to transfer logins, you will need to use the sp_help_revlogin script and procedure. This will allow you to transfer logins and retain the password from on instance to another.

share|improve this answer
I've been to that page but I evidently don't understand it. Method 3 says "Create a log in script that has a blank password", so presumably that isn't it? – Jack Douglas Apr 19 '14 at 17:08
@JackDouglas Not sure what that phrase means, but you just need to create those two stored procedures on the source server and, in the end, just execute sp_help_revlogin, take its output from SSMS and execute it on the new server. You'll have your logins recreated with the correct pwds. – Marian Apr 20 '14 at 15:30
i have tested this on SQL 2014 but does not work, the same method works till sql 2012. also mentioned in – imanabidi Aug 18 '15 at 8:57
I tested sp_help_revlogin but it does not work in SQL 2014 SP1 CU1(12.0.4416). This KB article mentions that it works until SQL Server 2012. – imanabidi Aug 18 '15 at 9:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.