rpresser (rpresser (AT) gmail (DOT) com) writes:
Quote:
I think I found an answer. Create a view that would return the illegal
rows, cross joined to a table that has more than one row, and create a
unique index on that view. The view cross joined to a multirow table
would result in multiple rows for each illegal row; the unique index
then prevents the row from being created. |
Now, that's wild!
My gut feeling when I look at the problem is that there is something wrong
in the modelling, but I can't point my finger on it. Well, it seems crazy
that different items on an order have different shipping options, but I
guess names have been changed to protect the innocent. And just with
abstract names, it difficult to say whether the model is correct or not.
The solution was amazing nevertheless.
--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx