DB2如何实现字段的自动增一,一定要救救我,真的散分

michael_yi 2001-12-12 01:24:19
在oracle中有sequence,在sqlserver中有identity(应该也是完成相同功能的吧?),我不太想使用trigger来完成,是否还有直接的或其他的方法类似identity?我是db2新手,希望能给我解释详细一些。不胜感激.

...全文
197 9 打赏 收藏 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
michael_yi 2001-12-13
  • 打赏
  • 举报
回复
我想给netyao(笑一笑:-) ),levin_li(levin)分,但怎么也找不到怎么给分,我以前给过的,但现在怎么找不到了。急死我了。
netyao 2001-12-12
  • 打赏
  • 举报
回复
When connected to a DB2 version 7.1 or higher database, ei-O uses the IDENTITY property to replicate the functionality of Access AutoNumber fields. The "GENERATED ALWAYS AS INDENTITY (START WITH x, INCREMENT BY y, CACHE z)" usage is specified when new DB2 tables are created and either the Access table contains no data or the "Data" option is not checked. In all other cases, "GENERATED BY DEFAULT AS IDENTITY (START WITH x, INCREMENT BY y, CACHE z)" is used.

The START WITH value can be any positive or negative value that could be assigned to this column. The default is 1.

The INCREMENT BY parameter cannot be zero or exceed the value of a large integer. The default is 1.

The CACHE value must be in the range of 2 to 32,767 and defaults to 20. Set the CACHE to 0 for NO CACHE.

netyao 2001-12-12
  • 打赏
  • 举报
回复
When connected to a DB2 version 7.1 or higher database, ei-O uses the IDENTITY property to replicate the functionality of Access AutoNumber fields. The "GENERATED ALWAYS AS INDENTITY (START WITH x, INCREMENT BY y, CACHE z)" usage is specified when new DB2 tables are created and either the Access table contains no data or the "Data" option is not checked. In all other cases, "GENERATED BY DEFAULT AS IDENTITY (START WITH x, INCREMENT BY y, CACHE z)" is used.

The START WITH value can be any positive or negative value that could be assigned to this column. The default is 1.

The INCREMENT BY parameter cannot be zero or exceed the value of a large integer. The default is 1.

The CACHE value must be in the range of 2 to 32,767 and defaults to 20. Set the CACHE to 0 for NO CACHE.

levin_li 2001-12-12
  • 打赏
  • 举报
回复
Create Table table_name
(
SERIALNO BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +1 , INCREMENT BY +1 , NO CACHE ),
.....
)
panther_totem 2001-12-12
  • 打赏
  • 举报
回复
没有用过,不知道,可以找一找。
netyao 2001-12-12
  • 打赏
  • 举报
回复
我找一找
michael_yi 2001-12-12
  • 打赏
  • 举报
回复
to superjj2002():
有一次你给别人回答过此类问题,但我没弄明白是怎么回事。能给我再回答一次吗?
michael_yi 2001-12-12
  • 打赏
  • 举报
回复
IronPromises(铁诺)哪里去了?数据库高手吧。帮帮我。
michael_yi 2001-12-12
  • 打赏
  • 举报
回复
db2高手,快来帮帮我,只要有价值,一定给分。
内容概要:本文围绕风光储与电解制氢系统仿真模型展开,重点构建了光伏耦合质子交换膜(PEM)电解水制氢系统的Simulink仿真平台。该模型深度融合风能、太阳能发电、储能系统与电解制氢环节,形成一个多能互补的综合能源系统架构,旨在探究在可再生能源出力波动条件下电解制氢的动态响应特性及能量管理策略。通过Simulink实现了光伏发电单元、风机、储能电池、功率变换器以及PEM电解槽等关键部件的模块化建模,并对系统在多种运行工况下的性能进行了仿真分析,验证了其在氢能稳定产出与能量灵活调节方面的可行性与有效性,为绿氢制备提供了重要的仿真技术支持。; 适合人群:具备电力电子、新能源系统或自动化等相关专业背景的研究生、科研人员及工程技术人员;熟悉Simulink仿真工具并从事综合能源系统、绿色氢能制备等领域研究的专业人士。; 使用场景及目标:①开展风光储氢耦合系统的建模与仿真研究;②优化可再生能源制氢过程中的能量调度与分配策略;③分析电解槽在间歇性电源输入下的动态工作特性与响应能力;④为实际绿氢示范项目的设计与运行提供仿真验证和技术支撑。; 阅读建议:建议读者结合Simulink模型文件进行同步操作与调试,深入理解各功能模块之间的接口关系与控制逻辑,可在现有模型基础上进一步拓展,如引入经济性评估、多目标优化算法或硬件在环测试等内容,以深化对系统性能的认知与研究层次。

34,876

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧