Assuming the following tables:
CREATE TABLE Shopping.Product (CategoryID INT NOT NULL)CREATE TABLE Shopping.Category (CategoryID INT PRIMARY KEY)ALTER TABLE Shopping.Product ADD CONSTRAINT FK_Product_Caetgory FOREIGN KEY(CategoryID) REFERENCES Shopping.Category
There is a typo in the foreign key name. How would you fix this using sp_rename? Is it…
-- 1. Just the object name as seen in sys.objects:sp_rename 'FK_Product_Caetgory', 'FK_Product_Category', 'OBJECT'-- 2. Qualified with the schema:sp_rename 'Shopping.FK_Product_Caetgory', 'FK_Product_Category', 'OBJECT'-- 3. Qualified with the schema and table:sp_rename 'Shopping.Product.FK_Product_Caetgory', 'FK_Product_Category', 'OBJECT'
If you picked #2, you are correct. This took me 10 mins to figure out.