sequence-sql

Entity Framework Code First and SQL Server 2012 Sequences

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-19 04:06:08
问题 I was in the middle of implementing a database audit trail whereby CRUD operations performed through my controllers in my Web API project would serialize the old and new poco's and store their values for later retrieval (historical, rollback, etc...). When I got it all working, I did not like how it made my controllers look during a POST because I ended up having to call SaveChanges() twice, once to get the ID for the inserted entity and then again to commit the audit record which needed to

In Netezza I'm trying to use a sequence in a case statement but the sequence value doesn't increment

二次信任 提交于 2019-12-10 13:55:29
问题 Here is the sequence creation syntax used: CREATE SEQUENCE BD_ID_SEQ AS INTEGER START WITH 999 INCREMENT BY 1 NO MINVALUE NO MAXVALUE NO CYCLE; I have a table with the following values records: b_id ------- 2547 NULL 2800 NULL NULL NULL NULL I run the following: select case when b_id is NULL then cast((select next value for bd_id_seq) as character varying(10)) else b_id end b_id from table1; The result comes to: b_id ------- 2547 1000 2800 1000 1000 1000 1000 I was expecting: 2547 1000 2800

Entity Framework Code First and SQL Server 2012 Sequences

故事扮演 提交于 2019-11-30 23:14:05
I was in the middle of implementing a database audit trail whereby CRUD operations performed through my controllers in my Web API project would serialize the old and new poco's and store their values for later retrieval (historical, rollback, etc...). When I got it all working, I did not like how it made my controllers look during a POST because I ended up having to call SaveChanges() twice, once to get the ID for the inserted entity and then again to commit the audit record which needed to know that ID. I set out to convert the project (still in its infancy) to use sequences instead of

Oracle Sequence Transactionality

雨燕双飞 提交于 2019-11-30 18:03:53
I need for a particular business scenario to set a field on an entity (not the PK) a number from a sequence (the sequence has to be a number between min and max I defined the sequence like this : CREATE SEQUENCE MySequence MINVALUE 65536 MAXVALUE 4294967296 START WITH 65536 INCREMENT BY 1 CYCLE NOCACHE ORDER; In Java code I retrieve the number from the sequence like this : select mySequence.nextval from dual My question is : If I call this " select mySequence.nextval from dual " in a transaction and in the same time in another transaction same method is called (parallel requests) it is sure

Oracle Sequence Transactionality

人盡茶涼 提交于 2019-11-30 02:45:57
问题 I need for a particular business scenario to set a field on an entity (not the PK) a number from a sequence (the sequence has to be a number between min and max I defined the sequence like this : CREATE SEQUENCE MySequence MINVALUE 65536 MAXVALUE 4294967296 START WITH 65536 INCREMENT BY 1 CYCLE NOCACHE ORDER; In Java code I retrieve the number from the sequence like this : select mySequence.nextval from dual My question is : If I call this " select mySequence.nextval from dual " in a