How To Create a User Name in a Database?
Submitted by: AdministratorUser names are security principals at the database level. If you want to allow a login name to access a specific database, you need to create a user name in that database and link it to the login name.
Creating a user name can be done by using the "CREATE USER" statement as shown in this tutorial exercise:
-- Login with "sa"
-- Create a login
CREATE LOGIN ggl_Login WITH PASSWORD = 'IYF'
GO
-- Select a database
USE GlobalGuideLineDatabase;
GO
-- Create a user and link it to a login
CREATE USER ggl_User FOR LOGIN ggl_Login;
GO
Login name "ggl_Login" should be able to access database "GlobalGuideLineDatabase" through user name "ggl_User".
Submitted by: Administrator
Creating a user name can be done by using the "CREATE USER" statement as shown in this tutorial exercise:
-- Login with "sa"
-- Create a login
CREATE LOGIN ggl_Login WITH PASSWORD = 'IYF'
GO
-- Select a database
USE GlobalGuideLineDatabase;
GO
-- Create a user and link it to a login
CREATE USER ggl_User FOR LOGIN ggl_Login;
GO
Login name "ggl_Login" should be able to access database "GlobalGuideLineDatabase" through user name "ggl_User".
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How to download Microsoft SQL Server 2005 Express Edition? |
☺ | What Are Binary String Data Types in MS SQL Server? |
☺ | How To Convert a Numeric Expression from One Data Type to Another? |
☺ | How To Declare and Use Cursor Variables? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |