override the generated by default on identity

override the generated by default on identity

Post by Diego Dal Ce » Fri, 24 May 2002 02:39:18



Hello all,

I'm having a big trouble with a table who has a "generated by default
as identity" column.
The fact is that I want to force a value to be inserted instead of the
generated one. In MSSQL and Sybase you can use "set identity_insert"
off and on to instruct the db engine to not to create an identity
value for the column and use the user's one.
Is there any similar feature in DB2?
Converting the "generated by default.." to a trigger would do the
trick?

Thank you very much in advance...

Diego Dal Cero.

 
 
 

override the generated by default on identity

Post by Serge Riela » Fri, 24 May 2002 05:46:31


Hi Diego,

I'm confused (as always). GENERATED BY DEFAULT does allow you to provide
your own values.
DB2 will only generate identity values if you specify DEFAULT or don't
provide a value at all.

Cheers
Serge
--
Serge Rielau
DB2 UDB SQL Compiler Development
IBM Software Lab, Canada

 
 
 

override the generated by default on identity

Post by Diego Dal Ce » Fri, 24 May 2002 23:33:19



> I'm confused (as always). GENERATED BY DEFAULT does allow you to provide
> your own values.
> DB2 will only generate identity values if you specify DEFAULT or don't
> provide a value at all.

Exactly, was a fault of mine... Really sorry and thank you very much for your time!

bye,
Diego Dal Cero.

 
 
 

1. Generating identity values without IDENTITY keyword

Hi!!
I want to insert several rows in an existent table. This table doesn't use
the IDENTITY keyword in the primary key field, but I would like to fill it
with increasing integer numbers.
The inserted rows come from a query from another table, and I found that
you can't assign a variable inside of a query to do something like this:


insert into MyTable (pk, field1, field2, ...)

from MyOtherTable

I have used the IDENTITY function (which is diferent from an Identity
property in a table), but then I have to use the INTO clause in the select
and create a temporary table.


into #TempTable
from MyOtherTable

insert into MyTable (pk,field1,field2, ...)
select *
from #TempTable

Is there any way to skip the temporary table creation?
--
Mario De Sousa Barrera
Eniac, C.A.
Caracas, Venezuela

2. 16 bit and 32 bit open client

3. Overriding a default error message in SQL Server

4. RAIMA Is on the Internet

5. override the default value for datetime datatype in sql server 7.0

6. Running Paradox 3.5 on Novell 4.11.

7. Override defaults in inherited fields and tables

8. concatenate names in tables for web addresses

9. Re : overriding default value in inherited column (+

10. Re : overriding default value in inherited column (+ set_value function)

11. overriding default value in inherited column

12. Overriding the default SQL cursor

13. Overriding the default logon screen in Forms 4.5