Results 1 to 3 of 3

Thread: how to restore logins with passwords

  1. #1
    Join Date
    Sep 2002
    Posts
    159

    how to restore logins with passwords

    Hi,

    I want to delete N number of logins today and restore them 5 days later.

    What steps should be done beside backup of master.

    what whould be the way to restore logins with passwords (with or without permissions )without restoring master?

    I gess just running sp_resolve_logins
    will not help.

    thank you
    Alex

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    SELECT 'EXEC sp_addlogin @loginame = ''' + loginname + ''''
    ,', @defdb = ''' + dbname + ''''
    ,', @deflanguage = ''' + language + ''''
    ,', @encryptopt = ''skip_encryption'''
    ,', @passwd ='
    , cast(password AS varbinary(256))
    ,', @sid ='
    , sid
    FROM syslogins
    WHERE name NOT IN ('sa')
    AND isntname = 0

    --This will produce a script. Store that script and re run it whenever u want to recreate. it creates all logins except SA and NTLogins.

  3. #3
    Join Date
    Sep 2002
    Posts
    159

    thank a lot Mak

    thank a lot, Mak

    it works fine

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •