UDB 7.2上的序列备选方案 [英] Sequence alternative on UDB 7.2

查看:71
本文介绍了UDB 7.2上的序列备选方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


除了触发器之外还有任何方法可以为

a中的列创建唯一编号插入...选择从"声明?


Thx,sr


-

KeinPlanüberlebtiersersteFeindberührung。

Hi there,

is there any way besides a trigger to create a unique number for a column in
a "insert into... select from" statement?

Thx, sr

--
Kein Plan überlebt die erste Feindberührung.

推荐答案

Steffen Ramlow写道:
Steffen Ramlow wrote:
你好,

还有什么方法除了触发为插入...选择中的列创建唯一编号
声明?
Hi there,

is there any way besides a trigger to create a unique number for a column
in a "insert into... select from" statement?




您可以编写自己的UDF或使用GENERATE_UNIQUE函数。在这个

你想要的东西?


-

Knut Stolze

信息集成

IBM德国/耶拿大学



You could write your own UDF or use the GENERATE_UNIQUE function. In this
something you would be looking for?

--
Knut Stolze
Information Integration
IBM Germany / University of Jena


你能使用标识栏吗?

指定默认生成和然后在你的select语句中你可以为这一列指定''DEFAULT''。


Steffen Ramlow写道:
Can you use an identity column?
Specify generated by default and then in your select statement you can
specify ''DEFAULT'' for that column.

Steffen Ramlow wrote:
你好在那里,

除了触发器之外还有任何方法可以为一个列创建一个唯一的数字,而不是插入...选择。陈述?

Thx,sr

KeinPlanüberlebtiersersteFeindberührung。
Hi there,

is there any way besides a trigger to create a unique number for a column in
a "insert into... select from" statement?

Thx, sr

--
Kein Plan überlebt die erste Feindberührung.




-

Anton Versteeg

IBM认证DB2专家

IBM荷兰



--
Anton Versteeg
IBM Certified DB2 Specialist
IBM Netherlands


Knut Stolze写道:
Knut Stolze wrote:
Steffen Ramlow写道:
Steffen Ramlow wrote:
你好,

有什么办法吗?除了触发器为插入...选择中的
列创建唯一编号声明?
Hi there,

is there any way besides a trigger to create a unique number for a
column in a "insert into... select from" statement?



您可以编写自己的UDF或使用GENERATE_UNIQUE函数。在
这个你想找的东西?



You could write your own UDF or use the GENERATE_UNIQUE function. In
this something you would be looking for?




正是我发现的:) Thanx!


我需要44个字符ID,这个有用:


CHAR(TIMESTAMP(GENERATE_UNIQUE()))||重复('''',18)


还有更好的方法吗?它确保44个字符吗?

-

KeinPlanüberlebtiersersteFeindberührung。



Exactly what I found out :) Thanx!

I need a 44 char Id, this works:

CHAR(TIMESTAMP(GENERATE_UNIQUE())) || REPEAT(''0'', 18)

Is there a better way? Does it ensure 44 chars?
--
Kein Plan überlebt die erste Feindberührung.


这篇关于UDB 7.2上的序列备选方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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