![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there any way around the SQL glitch that a check condition will always succeed when the table is empty? I do not want to have the first row be automatically accepted. |
#3
| |||
| |||
|
|
Gene Wirchenko (genew (AT) ocis (DOT) net) writes: Is there any way around the SQL glitch that a check condition will always succeed when the table is empty? I do not want to have the first row be automatically accepted. Not sure what you mean. If the table is empty, there is nothing to enforce. That does not mean if you add a row, that anything will be accepted. Could you clarify? |
#4
| |||
| |||
|
|
That is what I have read. There is even an example purporting to show this http://msdn.microsoft.com/en-us/library/ms188258.aspx It appears to be a false alarm. |
#5
| |||
| |||
|
|
Dear SQL'ers: * * *Is there any way around the SQL glitch that a check condition will always succeed when the table is empty? * * *I do not want to have the first row be automatically accepted. Sincerely, Gene Wirchenko |
#6
| |||
| |||
|
|
Dear SQL'ers: * * *Is there any way around the SQL glitch that a check condition will always succeed when the table is empty? * * *I do not want to have the first row be automatically accepted. Sincerely, Gene Wirchenko |
#7
| |||
| |||
|
|
On Jul 12, 3:12*pm, Gene Wirchenko <ge... (AT) ocis (DOT) net> wrote: Dear SQL'ers: * * *Is there any way around the SQL glitch that a check condition will always succeed when the table is empty? * * *I do not want to have the first row be automatically accepted. Sincerely, Gene Wirchenko Glitch? That is a law of logic; anything you say about non-existing thigns is true. Look up "Existental import" in a text book on the history of modern logic. And teh first row is not always accepted. *I have some situations with self-references to avoid gaps in the dates of a history that I start with CHECK() constraints off, insert a first row, turn teh DRI back on and proceed to insert as usual. |
#8
| |||
| |||
|
|
On Jul 12, 3:12*pm, Gene Wirchenko <ge... (AT) ocis (DOT) net> wrote: Dear SQL'ers: * * *Is there any way around the SQL glitch that a check condition will always succeed when the table is empty? * * *I do not want to have the first row be automatically accepted. Glitch? That is a law of logic; anything you say about non-existing thigns is true. Look up "Existental import" in a text book on the |
|
history of modern logic. And teh first row is not always accepted. |
|
I have some situations with self-references to avoid gaps in the dates of a history that I start with CHECK() constraints off, insert a first row, turn teh DRI back on and proceed to insert as usual. |
#9
| |||
| |||
|
|
Please expand "DRI". |
#10
| |||
| |||
|
|
Gene Wirchenko (genew (AT) ocis (DOT) net) writes: Please expand "DRI". Declarative Referential Integrity. That is constraints: CHECK and FOREIGN KEY constraints. And also PRIMARY KEY and UNIQUE constraints, although you cannot turn them off in SQL Server. In SQL Server DEFAULT is also termed as a constraint, but that is a bit incorrect. DRI should be seen in oppsition to RI checks implemented in triggrs. |
![]() |
| Thread Tools | |
| Display Modes | |
| |