sa_help_rev.erse.sa.login

  • James Marsh

    SSC Veteran

    Points: 202

    Comments posted to this topic are about the item sa_help_rev.erse.sa.login

  • Perry Whittle

    SSC Guru

    Points: 233794

    why not just use the system function fn_varbintohexstr()

    -----------------------------------------------------------------------------------------------------------

    [font="Tahoma"]"Ya can't make an omelette without breaking just a few eggs"[/font] 😉

  • James Marsh

    SSC Veteran

    Points: 202

    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. 🙂

  • Perry Whittle

    SSC Guru

    Points: 233794

    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

    -----------------------------------------------------------------------------------------------------------

    [font="Tahoma"]"Ya can't make an omelette without breaking just a few eggs"[/font] 😉

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply