且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何重置主键一旦从表中删除..?

更新时间:2023-11-24 13:53:34

当然可以。只要没有外键引用该主键。如果有的话,你也需要放弃它。实际语法取决于您使用的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[^]