Write a script to add user user to database adventureworks

Assignment Help Database Management System
Reference no: EM131299346

Assignment

SQL Server 2012 User Admin Tutorial

To Create User

There are two steps to create a user in SQL Server: create a login first, and then create a user. A valid login name is required to connect to an SQL Server instance. A login could be either of below.

A Windows login that has been granted access to SQL Server (username/password is kept by local OS or domain controller)
An SQL Server login, that is maintained within SQL Server (username/password is kept by SQL Server)
A login can have associated users in different databases, but only one user per database.

SQL Server and Windows Authentication Mode
CREATE LOGIN steve WITH PASSWORD='abc123';
CREATE USER steve FOR LOGIN [steve];

Windows Authentication Mode
CREATE LOGIN [cse1\steve] FROM WINDOWS;
CREATE USER steve FOR LOGIN [cse1\steve];

To allow user to connect to MS SQL Database
GRANT CONNECT TO steve;

To Remove User
To remove a user, use DROP. Users that own securables cannot be dropped from the database.
DROP USER steve;

A user can be disabled by revoking its CONNECT permission by executing
REVOKE CONNECT FROM steve;
Additional Reading

Managing Logins, Users, and Schemas How-to Topics https://msdn.microsoft.com/en-us/library/aa337552.aspx (Create schemas, create a login and create a database user)

Deliverables

Note: 1) Avoid using stored system procedure wherever possible. Example: use CREATE LOGIN instead of sp_addlogin see https://msdn.microsoft.com/en-us/library/ms173768.aspx

2) DO NOT USE GUI. You will not receive points if you use GUI.

D1. Create SQL Server login user1 - include the SQL script

D2. Set default database for user1 to AdventureWorks - include the SQL script

D3. Create user for login user1 in database AdventureWorks - include the SQL script

D4. Add permissions (see slides) for user1 to read and create tables in AdventureWorks and Insert rows. - include the SQL script and check user1's properties and provide a screenshots similar to one below.

D5. Perform following steps and answer questions - just include your answer in the deliverable.

Change type of authentication for MS SQL Server to Windows and SQL Server.

Right-click the Server and choose Properties. Under Security pick SQL Server and Windows Authentication mode

b) Restart MS SQL Server (not the computer) see below.

Disconnect and connect using SQL Server Authentication. Connect to SQL Server as user1. Try to select all products from Production.Product table (AdventureWorks database). What does the query return? How many rows were returned?

D6. As user1 create new table user1_table. - include the SQL code for creating and populating table.

testID
1234

D7. Disconnect and connect again using Windows Authentication Mode. Disable user1 login.- include the SQL script. Log off and logon using user1 login. - Describe what happened in the deliverable

D8. Logon using Windows Authentication Mode delete user1 SQL Server login.- include the SQL code used and explain what happened with table created in D6, user1_table.

D9. Use who2 procedure to find information about your own login. - include a screen shot.

Check system stored procedure in master database. Run who system procedure. You can find information about current Microsoft SQL Server users and processes. System Stored Procedures can be found under Programmability -> Storage Procedures

To run procedure you need to use following query:

execute procedure_schema.procedure_name

D10. Go to computer management and create user1 with password abc123. Grant user1 permission to login to SQL Server (It is Windows Integrated authentication) - include the SQL script for granting permission in the deliverable.

D11. Write a script to add user user1 to database AdventureWorks. Delete user user1 and login user1 - include the SQL script in the deliverable.

Reference no: EM131299346

Questions Cloud

Are these ratings biased or unreliable : The most popular restaurant. Each year the Zagat Survey lists the most popular restaurants in Los Angeles. In 2005, A.O.C. was ranked 5th but in 2004 it was ranked 31st. The Cheesecake Factory was ranked 7th in 2005 but was 2nd in 2004. Are these ..
Write a program which uses structure having indicated member : Write a program which uses a structure having the indicated member names to store the following data: The program will keep a list of three test scores for one student.
Describe a measurement process that you think is valid : Measuring physical fitness. You want to measure the "physical fitness" of college students. Give an example of a clearly invalid way to measure fitness. Then briefly describe a measurement process that you think is valid.
Calculate the owners break-even probability : Assume the league's reminder profits was $335 million. Assume costs of fan irritation from the lockout is equal to owners' next best alternative, calculate the owners'  break-even probability. Explain your results.
Write a script to add user user to database adventureworks : Write a script to add user user1 to database AdventureWorks. Delete user user1 and login user1 - include the SQL script in the deliverable.
Why the count of unemployed people is not a valid measured : Use these facts to explain why the count of unemployed people is not a valid measure of the extent of unemployment.
Identify factors that influence chief executive remuneration : Determine how this information can be used to identify the factors that influence chief executive remuneration - Univariate and bivariate analysis and discussion which looks at the possible determinants of CEO remuneration - Determine how this inform..
Influence of some actors on the world stage : Globalization has increased the influence of some actors on the world stage and decreased the influence of others. Of the five actors listed below, which ones have increased and which ones have decreased? Why? (Actors: states, IGOs, NGOs, MNCs, ne..
Government securities from a commercial bank : Using a required reserve ratio of 10% and assuming that the banks keep no excess reserves, which of the following scenarios produces a larger effect on the money supply?

Reviews

Write a Review

Database Management System Questions & Answers

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd