• An example of how to do this:

    First create a temp table in your SQL Management Studio, containing all the columns in your spreadsheet:

    CREATE TABLE #Staging

    ( UserId CHAR(15),

    UserName VARCHAR(35),

    .

    .

    .

    )

    Next, use BULK INSERT http://msdn.microsoft.com/en-us/library/ms188365(v=SQL.100).aspx to insert the data into this temp table

    BULK INSERT #Staging

    FROM '\\Share\Folder\FileName.xls'

    WITH(

    BATCHSIZE = 15000,

    CHECK_CONSTRAINTS,

    DATAFILETYPE = 'native',

    ROWS_PER_BATCH = 15000,

    ,

    ,

    )

    Then declare a cursor to iterate through the imported list to create the logins and allocate to a given database

    DECLARE @user-id CHAR(15), @UserName VARCHAR(35), ......

    DECLARE Users CURSOR LOCAL FAST_FORWARD FOR

    SELECT UserId, UserName .....

    FROM #Staging

    OPEN Users

    FETCH NEXT FROM Users INTO @user-id, @UserName, .....

    WHILE @@FETCH_STATUS = 0 BEGIN

    --Create login

    DECLARE @login NVARCHAR(100) =

    'CREATE LOGIN '+@UserID+'

    FROM WINDOWS;'

    BEGIN TRY

    EXEC sp_executesql @login

    END TRY

    BEGIN CATCH

    RAISERROR('There was an error creating login for user %s',16,1,@UserID)

    END CATCH

    --Grant Acccess to DB

    SELECT @login = 'USE GivenDatabase

    CREATE USER '++@UserID+'

    FOR LOGIN '+@UserID

    BEGIN TRY

    EXEC sp_executesql @login

    END TRY

    BEGIN CATCH

    RAISERROR('There was an error linking login for user %s to database GivenDatabase',16,1,@UserID)

    END CATCH

    FETCH NEXT FROM Users INTO @user-id, @UserName, .....

    END

    CLOSE Users

    DEALLOCATE Users

    DROP TABLE #Staging

    Does this help?

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”