关于identity

来源:互联网 发布:大数据的概念和特点 编辑:程序博客网 时间:2024/06/06 05:10

在Ms sql server 中, 有Identity类型(标识列, 自增长列).

 

如果使用 ole db连接数据库, Pb默认使用 select @@identity语法来获得dw中Identity列的新值(在update()之后, dw自动从数据库中获得).

 

在使用了向第二张表中插入新行的"触发器"的情况下, 如果第二张表中也有Identity列, 会导致dw在Update()后, 获得第二张表的最后的identity

 

解决方法是, 打开pbodbxx.ini文件, 把 GetIdentity='Select @@identity' 换成 GetIdentity='Select scope_identity()'

 

***以上方法是由 Jason 'Bug' Fenter [TeamSybase]在sybase论坛上提供的

 

在使用Mssql server 2005或2008时, 会出现以上方法不能获得identity的现象, 解决方法是使用 SQLNCLI 或 SQLNCLI10做 oledb的Provider.

***该方法是由Alfredo Santibáñez 在sybase论坛上提供的

本人同时在此向他们的无私帮助表示感谢!

原创粉丝点击