Hi Noel,
Let me know if this works for you:
CREATE TABLE permission (id IDENTITY);
CREATE TABLE users (id IDENTITY, version INT NOT NULL, last_modified
TIMESTAMP NOT NULL,
insert_permission_id BIGINT NOT NULL);
INSERT INTO permission VALUES();
INSERT INTO users (version, last_modified, insert_permission_id) VALUES
(0, NOW(), SCOPE_IDENTITY());
PS: Replacing SCOPE_IDENTITY() with IDENTITY() fixes the problem but
it's not clear why.
And a follow-up question: SCOPE_IDENTITY() says "changes [...] within
Java functions are ignored". What are "Java functions" in this context?
I am only aware of triggers.
Thanks,
Gili