Rename View
Sometimes ,it is necessary to rename view. There is two ways to rename a View. You can do it from object Explorer ,or you can do it by writing script. Here's the step ,how can we change the name of a view from object Explorer.
1)Form object Explorer select database
2)Select view, right click on the view you will get a context menu. 3)Select rename, write the name of the view .
You can also rename a View using "sp_rename". Below is example of view rename.For example , we have created a view as name "Student_List" and renamed it "new_Student_List"
Rename Trigger
You can rename a Trigger. Trigger can be the name from two places one from object Explorer and other from t-sql. Here's the step ,how can we change the name of a Trigger from object Explorer.
1)Form object Explorer select database
2)Select Trigger, right click on the Triggeryou will get a context menu.
3)Select rename, write the name of the Trigger.
You can also rename a Trigger using "sp_rename". Below is example of Trigger rename.For example , we have created a Trigger as name "tr_student" and renamed it "new_tr_student"
Rename Table
You can rename a Table. Table can be the name from two places one from object Explorer and other from t-sql. Here's the step ,how can we change the name of a Table from object Explorer.
1)Form object Explorer select database
2)Select Table, right click on the Table you will get a context menu.
3)Select rename, write the name of the Table.
You can also rename a Table using "sp_rename". Below is example of Table rename.For example , we have created a Table as name "STUDENT" and renamed it "new_STUDENT"
Sometimes ,it is necessary to rename view. There is two ways to rename a View. You can do it from object Explorer ,or you can do it by writing script. Here's the step ,how can we change the name of a view from object Explorer.
1)Form object Explorer select database
2)Select view, right click on the view you will get a context menu. 3)Select rename, write the name of the view .
You can also rename a View using "sp_rename". Below is example of view rename.For example , we have created a view as name "Student_List" and renamed it "new_Student_List"
CREATE
VIEW Student_List AS
SELECT
*
FROM
STUDENT
EXEC
sp_rename
'dbo.Student_List',
'new_Student_List'
Rename Trigger
You can rename a Trigger. Trigger can be the name from two places one from object Explorer and other from t-sql. Here's the step ,how can we change the name of a Trigger from object Explorer.
1)Form object Explorer select database
2)Select Trigger, right click on the Triggeryou will get a context menu.
3)Select rename, write the name of the Trigger.
You can also rename a Trigger using "sp_rename". Below is example of Trigger rename.For example , we have created a Trigger as name "tr_student" and renamed it "new_tr_student"
CREATE
TRIGGER tr_student
ON
STUDENT
AFTER
INSERT,
UPDATE,
DELETE
AS
PRINT
('You
made one DML operation');
GO
EXEC
sp_rename
'dbo.tr_student',
'new_tr_student'
Rename Table
You can rename a Table. Table can be the name from two places one from object Explorer and other from t-sql. Here's the step ,how can we change the name of a Table from object Explorer.
1)Form object Explorer select database
2)Select Table, right click on the Table you will get a context menu.
3)Select rename, write the name of the Table.
You can also rename a Table using "sp_rename". Below is example of Table rename.For example , we have created a Table as name "STUDENT" and renamed it "new_STUDENT"
CREATE
TABLE
STUDENT
(
[student_name]
VARCHAR(500),
[class]
INT,
[section]
VARCHAR(5),
[marks]
INT
);
EXEC
sp_rename
'dbo.STUDENT',
'new_STUDENT'
No comments:
Post a Comment