Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Databases Programming Interviews:BtrieveClipperData ModelingData StructuresDatabase AdministrationDatabase Administrator (DBA)Database AnalystDatabase DeveloperDB DevelopmentEDI/Data Integration ExpertFirebirdHierarchicalIBM DB2InformixJava DatabaseMariaDBMicrosoft Access DeveloperMongoDBMS SQL ServerMySQL ProgrammingNetworkNoSQLObject RelationalPostgrePostgreSQLProgressRDBMSRelationalSQLSQL AdministratorSQL and PL/SQLSQL Notification ServicesSQL server 2008SSRSStored ProcedureSybaseTeradata
Copyright © 2018. All Rights Reserved
MS SQL Server Interview Question:
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
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.