May 12, 2012 at 11:39 am
Comments posted to this topic are about the item sa_help_rev.erse.sa.login
May 14, 2012 at 4:40 am
why not just use the system function fn_varbintohexstr()
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
May 14, 2012 at 11:29 am
Perry,
The answer is quite simple. I knew sp_help_revlogin already did something similar to what I needed. As I cracked into it to find out what it was doing I found it easier to whittle it down to do what I needed. As I mentioned I was on a time crunch to change those passwords for security compliance reasons, so I went with the simplest path for me at the time. I would love to see other ways to accomplish this task. I am unfamiliar with the fn_varbintohexstr function, but I will look into how it works. If you have an example to kick start my learning process it would be much appreciated.
May 15, 2012 at 5:25 am
Sure, here you go
SELECT 'CREATE LOGIN ' + name +
' WITH PASSWORD = ' + sys.fn_varbintohexstr(password_hash) +
' HASHED, SID = ' + sys.fn_varbintohexstr(sid) +
', DEFAULT_DATABASE = ' + QUOTENAME(default_database_name) +
', DEFAULT_LANGUAGE = ' + default_language_name +
', CHECK_EXPIRATION = ' +
CASE
WHEN is_expiration_checked = 0 THEN 'OFF'
ELSE 'ON'
END + ', CHECK_POLICY = ' +
CASE
WHEN is_policy_checked = 0 THEN 'OFF'
ELSE 'ON'
END
FROM sys.sql_logins
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy