unique constraint on two tables?
am 05.05.2007 19:49:03 von igorIs it possible to create a unique constraint on two tables?
In mssql2000?
Is it possible to create a unique constraint on two tables?
In mssql2000?
You mean spaning two tables? No, not as such. You could try creating an
indexed view, but that will hurt performance. Anyway, perhaps supertype is
in order (depending on the enitites)?
MC
"Igor"
news:1178387342.966780.319330@q75g2000hsh.googlegroups.com.. .
> Is it possible to create a unique constraint on two tables?
> In mssql2000?
>
Igor wrote:
> Is it possible to create a unique constraint on two tables?
> In mssql2000?
What is the business requirement. What is it you are trying to
accomplish?
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
I believe UNION is one of the disallowed constructs of an indexed view.
However, I agree that the need to do this is probably a schema design issue.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"MC"
news:f1ijhg$c13$1@ss408.t-com.hr...
> You mean spaning two tables? No, not as such. You could try creating an
> indexed view, but that will hurt performance. Anyway, perhaps supertype is
> in order (depending on the enitites)?
>
> MC
>
>
> "Igor"
> news:1178387342.966780.319330@q75g2000hsh.googlegroups.com.. .
>> Is it possible to create a unique constraint on two tables?
>> In mssql2000?
>>
>
>
Igor (jerosimic@gmail.com) writes:
> Is it possible to create a unique constraint on two tables?
> In mssql2000?
Assuming that the two tables have each half of the domain, define
check constraints to keep the tables apart. This in fact how you
implement a partitioned view.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downlo ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books .mspx
You're right offcourse. Union is not allowed in indexed view. So, either
redesign or programmatical checking...
MC
"Dan Guzman"
news:lf6%h.222$4X.95@nlpi069.nbdc.sbc.com...
>I believe UNION is one of the disallowed constructs of an indexed view.
>However, I agree that the need to do this is probably a schema design
>issue.
>
> --
> Hope this helps.
>
> Dan Guzman
> SQL Server MVP
>
> "MC"
> news:f1ijhg$c13$1@ss408.t-com.hr...
>> You mean spaning two tables? No, not as such. You could try creating an
>> indexed view, but that will hurt performance. Anyway, perhaps supertype
>> is in order (depending on the enitites)?
>>
>> MC
>>
>>
>> "Igor"
>> news:1178387342.966780.319330@q75g2000hsh.googlegroups.com.. .
>>> Is it possible to create a unique constraint on two tables?
>>> In mssql2000?
>>>
>>
>>
>
I redesigned my website so i dont need it now, thank you all.
I had two tables one for opened requests and another for closed
requests, they have different columns. When request is solved it is
moved to requests_finished table and deleted from requests_opened... I
thought i would explain what i wanted but english is not my primary
language and explaining it is so hard and it's not important anymore
so i give up :)
Well, next time perhaps making one table with requests and adding status
column (opened, closed....)?
MC
PS. Hmm, ili ako si slucajno iz ovih krajeva mozes se ti i na mejl javit :)
"Igor"
news:1178545983.249305.210700@e65g2000hsc.googlegroups.com.. .
>I redesigned my website so i dont need it now, thank you all.
>
> I had two tables one for opened requests and another for closed
> requests, they have different columns. When request is solved it is
> moved to requests_finished table and deleted from requests_opened... I
> thought i would explain what i wanted but english is not my primary
> language and explaining it is so hard and it's not important anymore
> so i give up :)
>