开发者

GUID as PK for DB2-400

I have a table that does not have a PK and I need to add one.

I was just going to add an an auto incrementing int as the last column (the database is not fully SQL so where I add the column actually matters).

I've heard talk of UID's a function that returns a unique identifier every time it is called so no two rows i开发者_开发问答n any table that uses a UID would have the same unique identifier.

Does DB2400 (the DB2 on an AS400 or iSeries) have such a function?


You don't say what version of iSeries software you are running, but newer releases of the OS (> 6.1) include the GENERATE_UNIQUE function for DB2.


You could use the ROW_ID data type or use the AS IDENTITY clause along with the GENERATE clause on both to create UIDs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜