Re: Re: MDB 2.x
| From: | Michael Wallner | Date: | Fri, 22 Aug 2003 13:06:04 +0000 |
| Subject: | Re: Re: MDB 2.x | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-20399@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Lukas Smith, you wrote:
>>From: Michael Wallner [mailto:m.wallner@iworks.at]
>>Sent: Thursday, August 21, 2003 3:42 PM
>>It seems that the INSERT query is still not working...
>>Also the last line of the log ist interesting...
>
>
> Ok will take a look.
> I will also see if I can fix the lob support.
Hi, again :)
So, I think I've figuerd out, why the
INSERTs resp. the sequences don't work.
If we drop the following INSERT statement on
our sequence_table:
INSERT INTO test_sequence_1_seq (sequence) VALUES (NULL)
MSSQL "thinks" we want to insert a specific value
into the sequence column, but if IDENTITY_INSERT is
set tot OFF (default, described below) the following
error occurs:
Cannot insert explicit value for identity column in table
'test_sequence_1_seq' when IDENTITY_INSERT is set to OFF
So what does it mean?
One can set IDENTITY_INSET to ON only on _one_
table/sequence at one time.
I think of two ways handling this:
1)
sequence table would be of two colums:
sequence INT NOT NULL IDENTITY(1,1), (-> just what it is now)
dummy BIT NULL
increase the sequence with:
INSERT INTO seq_tbl (dummy) VALUES (NULL)
2)
integrate the sequence in the data table, but
I think you would also have done that with MySQL
and auto_increment if that would be handy to
realize, so this is no real option, is it?
Why not just drop
SET IDENTITY_INSERT seq_tbl ON
before increasing the sequence column of the seq_tbl?
Because if sequence is defined NOT NULL, MSSQL raises
an error that NULL cannot be inserted, and IDENTITY
columns cannot be defined NULL.
So far...
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (Cygwin)
iD8DBQE/RhU83645gzRPvy8RArOiAJ98tKv6lqabkfJzKGMwyc8mP7A92ACeKkg2
9S5DsTGLeJgLhv7Jc7sQUDg=
=H3I8
-----END PGP SIGNATURE-----