如何在已创建的表中添加sequantial数列列 [英] how to add sequantial number column column in already created table
本文介绍了如何在已创建的表中添加sequantial数列列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一个接一个地严格递增
解决方案
< blockquote>请参阅此处: http://technet.microsoft.com/en-us/library/ms186775.aspx [ ^ ]
您好,
查看以下链接.....
SQL Server中的IDENTITY属性 [ ^ ]
更改现有表Sql Server中的标识列 [ ^ ]
如何将列更改为标识(1,1) [ ^ ]
问候,
GVPrabu
您可以将新列添加为标识字段。如果身份已存在。在表格中添加记录时,您必须执行以下操作:
DECLARE @ MAX AS INT
SELECT @ MAX = ISNULL(MAX(NEWCOLUMN)+ 1 , 1 ) FROM TABLE_1
INSERT INTO TABLE_1(NEWCOLUMN,EXISTINGCOLUMN)
VALUES ( @ MAX ,' TEST' 跨度>)
10 field in my table now i want to add another column in my table with sequance numbering.
strictly increment one by one
解决方案
See here: http://technet.microsoft.com/en-us/library/ms186775.aspx[^]
Hi,
Check the below links also.....
IDENTITY Property in SQL Server[^]
alter Identity column in existing table Sql Server[^]
How to alter column to identity(1,1) [^]
Regards,
GVPrabu
You can add the new column as Identity field. In case the Identity already exists . while adding the record in the table, you will have to do the below:
DECLARE @MAX AS INT SELECT @MAX = ISNULL(MAX(NEWCOLUMN) + 1,1) FROM TABLE_1 INSERT INTO TABLE_1 (NEWCOLUMN, EXISTINGCOLUMN) VALUES (@MAX,'TEST')
这篇关于如何在已创建的表中添加sequantial数列列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文