如何在现有视图中添加列或更改某些字段 [英] How to add a column or change some fields in a existing view

查看:1512
本文介绍了如何在现有视图中添加列或更改某些字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有一个表 EMP_DETAILS ,其中包含( EMP_ID(主键),FIRST_NAME,LAST_NAME,AGE,ADDRESS,SALARY,DEPT_ID(外键),

DELETE_DATE
)。



我已经为表创建了一个视图,但是当我创建该表时,我错过了一列( FIRST_NAME )。



我想在此现有视图中添加该列,并将其删除。

I already have a table EMP_DETAILS, which is containing (EMP_ID (Primary Key), FIRST_NAME, LAST_NAME, AGE, ADDRESS, SALARY, DEPT_ID (Foreign Key),
DELETE_DATE
).

I already created a View for the table, but when I created that table I missed one column (FIRST_NAME).

I want to add that column in this existing View with out drop this.

推荐答案





无需放弃

改变你的观点。

试试这个。



更改视图view_name

as

更改您的查询



更改后执行上述操作。

可能对您有帮助。


no need to drop
alter your view.
try this.

alter view view_name
as
change your query

execute the above after change.
might this help you.


步骤1:使用sp_helptext查看视图的定义。



第2步:复制视图的定义并将其贴在T-SQL窗口中



步骤3:更改创建查看为Alter视图,然后在视图中添加新列,一旦完成更改执行查询窗口。然后更新视图的定义。
Step 1 : use sp_helptext to view the definition of the view.

step 2 : copy the definition of the view and paster it in the T-SQL window

step 3 : change the create view as Alter view and then add the new columns in the view, once the alteration in completed execute the query window. Then the definition of the view is updated.


什么是BISA1.EMPLOYEE_DETAILS_VIEW

仅使用EMPLOYEE_DETAILS_VIEW
what is BISA1.EMPLOYEE_DETAILS_VIEW
use EMPLOYEE_DETAILS_VIEW only


这篇关于如何在现有视图中添加列或更改某些字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆