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 login account in MS SQL Server to access the database engine using "CREATE LOGIN" statements?
Submitted by: AdministratorNow this answer will teach you that how to create login and configure users for databases with Transact-SQL statements. Granting a user access to a database involves three steps. First, you create a login. The login lets the user connect to the SQL Server Database Engine. Then you configure the login as a user in the specified database. And finally, you grant that user permission to database objects. This lesson shows you these three steps, and shows you how to create a view and a stored procedure as the object. This tutorial assumes that you are running SQL Server Management Studio Express.
To access the Database Engine, users require a login. The login can represent the user's identity as a Windows account or as a member of a Windows group, or the login can be a SQL Server login that exists only in SQL Server. Whenever possible you should use Windows Authentication.
By default, administrators on your computer have full access to SQL Server. For this lesson, we want to have a less privileged user; therefore, you will create a new local Windows Authentication account on your computer. To do this, you must be an administrator on your computer. Then you will grant that new user access to SQL Server. The following instructions are for Windows XP Professional.
Submitted by: Administrator
To access the Database Engine, users require a login. The login can represent the user's identity as a Windows account or as a member of a Windows group, or the login can be a SQL Server login that exists only in SQL Server. Whenever possible you should use Windows Authentication.
By default, administrators on your computer have full access to SQL Server. For this lesson, we want to have a less privileged user; therefore, you will create a new local Windows Authentication account on your computer. To do this, you must be an administrator on your computer. Then you will grant that new user access to SQL Server. The following instructions are for Windows XP Professional.
Submitted by: Administrator
To create a new Windows account - Click Start, click Run, in the Open box, type %SystemRoot%system32compmgmt.msc /s, and then click OK to open the Computer Management program.
Under System Tools, expand Local Users and Groups, right-click Users, and then click New User.
In the User name box type Mary.
In the Password and Confirm password box, type a strong password, and then click Create to create a new local Windows user.
To create a login - In a Query Editor window of SQL Server Management Studio, type and execute the following code replacing computer_name with the name of your computer. FROM WINDOWS indicates that Windows will authenticate the user. The optional DEFAULT_DATABASE argument connects Mary to the YourDataBaseNamedatabase, unless her connection string indicates another database. This statement introduces the semicolon as an optional termination for a Transact-SQL statement.
CREATE LOGIN [computer_nameMary]
FROM WINDOWS
WITH DEFAULT_DATABASE = [YourDataBaseName];
GO
This authorizes a user name Mary, authenticated by your computer, to access this instance of SQL Server. If there is more than one instance of SQL Server 2005 on the computer, you must create the login on each instance that Mary must access.
Submitted by: Administrator
Under System Tools, expand Local Users and Groups, right-click Users, and then click New User.
In the User name box type Mary.
In the Password and Confirm password box, type a strong password, and then click Create to create a new local Windows user.
To create a login - In a Query Editor window of SQL Server Management Studio, type and execute the following code replacing computer_name with the name of your computer. FROM WINDOWS indicates that Windows will authenticate the user. The optional DEFAULT_DATABASE argument connects Mary to the YourDataBaseNamedatabase, unless her connection string indicates another database. This statement introduces the semicolon as an optional termination for a Transact-SQL statement.
CREATE LOGIN [computer_nameMary]
FROM WINDOWS
WITH DEFAULT_DATABASE = [YourDataBaseName];
GO
This authorizes a user name Mary, authenticated by your computer, to access this instance of SQL Server. If there is more than one instance of SQL Server 2005 on the computer, you must create the login on each instance that Mary must access.
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.