• here's the basics of it: generate the orphans from the meta data:

    /*--Results

    ALTER USER [z_AppDB_reports] WITH LOGIN = [z_AppDB_reports];

    ALTER USER [medical] WITH LOGIN = [medical];

    */

    SELECT 'ALTER USER ' + quotename(dbloginz.name) + ' WITH LOGIN = ' + quotename(svloginz.name) + ';'

    from sys.database_principals dbloginz

    LEFT OUTER JOIN sys.server_principals svloginz

    on dbloginz.name = svloginz.name

    WHERE dbloginz.type IN ('S')

    AND dbloginz.name NOT IN('dbo','guest','INFORMATION_SCHEMA','sys')

    and svloginz.name is not null and dbloginz.sid <> svloginz.sid

    to do it as a single script, server wide, you'd have to add a cursor i guess, but it's certainly doable.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!