Why does Teradata Identity column have negative values?

∥☆過路亽.° 提交于 2019-12-11 11:40:30

问题


I am very new to Teradata (1 week) and my primary skillset is SQL Server. I am pulling data from one of the TeraData tables to SQL Server table and the TD table has an Identity column with negative values. I looked at the DDL for that table and it does not mention a start with and end with values.

So, how does TeraData have the negative values in there? Also, if I pull this over to SQL Server, should I create a new Identity Column or should I just maintain the Identity values I get from TeraData?


回答1:


If the column is defined as GENERATED BY DEFAULT the negative values might have been inserted directly.

If it's GENERATED ALWAYS without NO CYCLE and the MAXVALUE has been reached it will start again at the MINVALUE, by default min and max are based on the possible range of the datatype.

IDENTITY columns are hardly used in Teradata, decide based on your needs if you need to keep them.




回答2:


A -1 or zero is often used in a data warehouse identity column as a place holder so the Fact foreign key is not null. It speeds up joins and you know it was there on purpose.



来源:https://stackoverflow.com/questions/26409717/why-does-teradata-identity-column-have-negative-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!