本文介绍了如何删除SQL表中的标识列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
我在MSSQL 2014表中遇到过问题。在我的项目中,我有很多表(136)



现在我需要删除标识列'SNo'当我使用普通命令'ALTER TABLE AD_FGMaster DROP COLUMN SNO'



错误是对象'PK_AD_FGMaster'依赖于列'SNo'。



因为它与很多View捆绑在一起。很难找到。

是否有任何方法可以放下表中的列以及视图中的列?



请给我建议。



谢谢

maideen



我尝试了什么:



我试过这段代码ALTER TABLE AD_FGMaster DROP COLUMN SNo



但错误是

消息5074,等级16,状态1,行5

对象'PK_AD_FGMaster'取决于列' SNo'。

消息5074,等级16,状态1,行5

对象'FK_AD_FGMaster_sno'取决于列'SNo'。

消息5074,16级,状态1,第5行

对象'FK_AD_FGMaster_sno'取决于列'SNo'。

消息4922,等级16,状态9,行5

ALTER TABLE DROP COLUMN SNo失败,因为一个或多个对象访问此列。

HiI have in issue in MSSQL 2014 table. In my Project, I have lots of table(136)

Now I need to delete the identity column 'SNo' When I used normal command 'ALTER TABLE AD_FGMaster DROP COLUMN SNo '

Error is "The object 'PK_AD_FGMaster' is dependent on column 'SNo'.

Because it is tied up to so many View. It is difficult to find.
Is there any way drop the column in table as well as in view also?

Pls advice me.

Thank you
maideen

What I have tried:

I have tried this code "ALTER TABLE AD_FGMaster DROP COLUMN SNo"

But error is
Msg 5074, Level 16, State 1, Line 5
The object 'PK_AD_FGMaster' is dependent on column 'SNo'.
Msg 5074, Level 16, State 1, Line 5
The object 'FK_AD_FGMaster_sno' is dependent on column 'SNo'.
Msg 5074, Level 16, State 1, Line 5
The object 'FK_AD_FGMaster_sno' is dependent on column 'SNo'.
Msg 4922, Level 16, State 9, Line 5
ALTER TABLE DROP COLUMN SNo failed because one or more objects access this column.

推荐答案


这篇关于如何删除SQL表中的标识列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 16:33