SQL Server 2000中的Auto_Increment列 [英] Auto_Increment Column in SQL Server 2000

查看:91
本文介绍了SQL Server 2000中的Auto_Increment列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello CPers,



我想知道是否可以将列自动增加而不将其更改为 IDENTITY SQL Server 2000 中的code>。据我所知, SQL2000 不支持,但有人可能实现了这个吗?



对于那些可能建议我使用

Hello CPers,

I would like to know is it possible to make a column auto-increment without changing it to IDENTITY in SQL Server 2000. As far as I know it is not supported in SQL2000 but is there someone who might implemented this?

For those who might suggest me to use

MAX(column_name) + 1

对于那种情况是不可能的。



提前致谢。

for that situation it is not possible.

Thanks in advance.

推荐答案

SQL Server 2000支持IDENTITY。请查看以下链接

http://msdn.microsoft.com/ en-us / library / aa933196(v = sql.80).aspx [ ^ ]
IDENTITY is supported in SQL Server 2000. Please check below link
http://msdn.microsoft.com/en-us/library/aa933196(v=sql.80).aspx[^]


嘿,

你可以使用COUNT函数。 />
Hey,
You can use COUNT function.
select count(*) from your_table



获取表中记录的计数并加1。

但是,这样可以正常工作只有当你没有从桌子上实际删除记录,否则它将在任何条件下工作。



希望这可以帮助你。



问候,

Lok ..


Get the count of the record in the table and add 1 to it.
But, this will work fine only if you are not deleting the records physically from the table otherwise it will work in any condition.

Hope this helps you.

Regards,
Lok..


这篇关于SQL Server 2000中的Auto_Increment列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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