how to create user

  • Hi all

    Some developer asked me please create user for me for read to some application (XXX)

    please tell me how to create user what permission grant to him

    thanks advance

  • Assuming you are using windows authentication and you wish to only grant READ ONLY access, this should work: USE [master]

    GO

    CREATE LOGIN [DOMAIN\username] FROM WINDOWS WITH DEFAULT_DATABASE=[master]

    GO

    USE [DatabaseYouAreGrantingAccessTo]

    GO

    CREATE USER [DOMAIN\username] FOR LOGIN [DOMAIN\username]

    GO

    EXEC sp_addrolemember N'db_datareader', N'DOMAIN\username'

    GO

    GRANT SELECT TO [DOMAIN\username]

    GO

    GRANT SHOWPLAN TO [DOMAIN\username]

    GO

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

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

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