Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
To remove all traces of this tutorial, you could just delete the database. However, in this topic, you will go through the steps to reverse every action you took doing the tutorial.
Removing permissions and objects
Before you delete objects, make sure you are in the correct database:
USE TestData; GOUse the
REVOKEstatement to remove execute permission forMaryon the stored procedure:REVOKE EXECUTE ON pr_Names FROM Mary; GOUse the
DROPstatement to remove permission forMaryto access theTestDatadatabase:DROP USER Mary; GOUse the
DROPstatement to remove permission forMaryto access this instance of SQL Server 2005:DROP LOGIN [<computer_name>\Mary]; GOUse the
DROPstatement to remove the store procedurepr_Names:DROP PROC pr_Names; GOUse the
DROPstatement to remove the viewvw_Names:DROP View vw_Names; GOUse the
DELETEstatement to remove all rows from theProductstable:DELETE FROM Products; GOUse the
DROPstatement to remove theProductstable:DROP Table Products; GOYou cannot remove the
TestDatadatabase while you are in the database; therefore, first switch context to another database, and then use theDROPstatement to remove theTestDatadatabase:USE MASTER; GO DROP DATABASE TestData; GO
This concludes the Writing Transact-SQL Statements tutorial. Remember, this tutorial is a brief overview and it does not describe all the options to the statements that are used. Designing and creating an efficient database structure and configuring secure access to the data requires a more complex database than that shown in this tutorial.
Return to SQL Server Tools Portal
Tutorial: Writing Transact-SQL Statements
See Also
REVOKE (Transact-SQL)
DROP USER (Transact-SQL)
DROP LOGIN (Transact-SQL)
DROP PROCEDURE (Transact-SQL)
DROP VIEW (Transact-SQL)
DELETE (Transact-SQL)
DROP TABLE (Transact-SQL)
DROP DATABASE (Transact-SQL)