CHAPTER 31
Objects and Dependencies
Almost everything in a database is an object; this includes tables, constraints, views, functions, and stored procedures. Inevitably, there will come a time when you need to work on these at the object level: from renaming to moving to a different schema, to determining dependencies between objects. This chapter covers maintaining and working with database objects at the object level.
31-1. Changing the Name of Database Items
Problem
You need to change the name of an item in a database.
Solution
Utilize the system-stored procedure sp_rename to rename an item in the database as follows:
Get SQL Server T-SQL Recipes, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.