Create same password for 150 users with script.

  • Hi, I want to create same password for 150 users in a database with script no GUI, I am told i can do that using cursor but i dont have any experience creating and specially using cursors.

    Anybody has a script to help me to create password for already created users.

    Thanks

    Irfan

  • Running the query below with results to text will generate the script to change all SQL login passwords.

    SELECT 'ALTER LOGIN '+'['+name+']'+' WITH PASSWORD = ''<yourpasswordhere>'';'

    FROM sys.server_principals

    WHERE type = 'S'

  • Thanks for quick reply, but i dont want to change password for all users, only for select users, i have around 200 user but want to change only of around 150.

    Thanks again for response.

    Irfan

  • Delete the 50 in the script you don't need. Or figure out how you determine which 150 you need. There isn't a script that can read your mind to determine which ones need to be changed.

  • ok, I'll ask - why do you want all your users (well, three quarters) to have the same password?

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

  • george sibbald (12/3/2010)


    ok, I'll ask - why do you want all your users (well, three quarters) to have the same password?

    I'm right there with George on this one. There's no absolutely no accountability if so many users are assigned the same password unless it's a one time password that they're required to change on the first login.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 6 posts - 1 through 5 (of 5 total)

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