如何重置主键一旦从表中删除..? [英] how to reset primary key once drop it from table..?

查看:86
本文介绍了如何重置主键一旦从表中删除..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的问题是无法将数据插入表中..

beacuse表有4 pk ..该列不允许正确插入数据。所以我需要删除主键一次和老化将其重置回同一个表..有可能请帮帮我..

I have encountered in a problem that is am not able insert data into table..
beacuse table having 4 pk ..that column is not allowing to insert data properly.so i need to drop primary key once and aging reset it back to same table..is it possible please help me out..

推荐答案

当然可以。只要没有外键引用该主键。如果有的话,你也需要放弃它。实际语法取决于您使用的RDBMS。 SQL只是一个语言名称。

以下是在SQL Server中执行此操作的方法: https://msdn.microsoft.com/en-us/library/ms190621.aspx [ ^ ]



一旦删除,你可以重新创建就像你之前创建的一样简单。

以下是SQL Server的方法: https:// msdn .microsoft.com / zh-CN / library / ms189039.aspx [ ^ ]
Of course you can. As long as there is no foreign key referring to that primary key. If there is, you need to drop that too. The actual syntax depends on the RDBMS you are using. SQL is just a language name.
Here is how you can do it in SQL Server: https://msdn.microsoft.com/en-us/library/ms190621.aspx[^]

Once it is dropped you can recreate is as easy as you created it before.
Here is the SQL Server way to do it: https://msdn.microsoft.com/en-us/library/ms189039.aspx[^]


这篇关于如何重置主键一旦从表中删除..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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