Home Forums SQL Server 2005 SQL Server Newbies I need differences between Roles, Schemas, Users and Logins. Can anyone help me. Thanks in advance RE: I need differences between Roles, Schemas, Users and Logins. Can anyone help me. Thanks in advance

  • Theses are concepts that are good starting points if you are new to SQL Server, and reading Books Online is a good place to start also. It is best to read about these concepts first, and then ask more specific questions, that way the more experienced DBAs will feel like you have an interest in the topic and are willing to research as appropriate.

    Roles: I think of creating roles in the database to group users of like function. Roles are granted certain permissions in the database. You should become familiar with the fixed database roles since these will be utilized once you start creating users within the database. Also, once you see the type of permissions that are granted to each role, is makes more sense.

    Schema: there can be several schemas in a database, which will house different types of objects such as tables, indexes, stored procedures, functions, etc. Users own schemas. Looking into the AdventureWorks database illustrates this concept, with several schemas like HR, Production, etc.

    Login: Think about login as gaining access to the SQL Server instance. If a user account is not granted any permissions within the instance, you basically just were able to unlock the door and enter the room, by creating a user you then grant access to the database objects or principals, and can begin to work with them.

    Users: Users own schemas, and as such will be able to manipulate the objects they own. Some of the manunipulations are very permissive, such as creating tables, indexes, stored procedures, functions, etc. These are developers and administrators.

    Users are created and granted permissions for application use, which will have select, update, insert, and delete and execute permissions to a finite set of objects in the schema, for which the application will need to function properly.

    In a client server database, as an example, of the structure. Roles were defined which provides the permissions to the database objects in the database, which only has one schema 'dbo'. One SQL server login was created with the same username, and dbo is the assigned default schema, and the roles assigned to that username.

    In the application, each specific user is given there own "application" login which is mapped to the one defined sql server login.

    Hope this helps with understanding some of these concepts.

    Good luck with your studying.

    Jennifer