User and user setting in MS SQL



  • Log/cool for another user should be developed remotely and access to the database should be made available. I finally got something like that:

    CREATE LOGIN somelogin WITH PASSWORD = 'passssssss';
    USE SOMEDB;
    CREATE USER someuser FOR LOGIN somelogin WITH DEFAULT_SCHEMA = dbo;
    GRANT CONTROL TO someuser;
    

    But some of them need access to other users.

    How do such users give such access?

    Or maybe we could create two users with the right designs and tie some logic to them?



  • To create logic, you need to be a member of a special role. securityadmin server:

    EXEC [master]..sp_addsrvrolemember @loginame = N'LoginName', @rolename = N'securityadmin'
    GO
    

    SqlServer 2012 and beyond may also:

    ALTER SERVER ROLE [securityadmin] ADD MEMBER [LoginName]
    GO
    

    To build users of the base, you need to be a member of a special role. db_securityadmin bases:

    USE [Database]
    GO
    EXEC sp_addrolemember @rolename = N'db_securityadmin', @membername = N'MemberName'
    GO
    

    SqlServer 2012 and beyond can be:

    USE [Database]
    GO
    ALTER ROLE [db_securityadmin] ADD MEMBER [MemberName]
    GO
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2