unique constraint on two tables?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Igor

    unique constraint on two tables?

    Is it possible to create a unique constraint on two tables?
    In mssql2000?

  • MC

    #2
    Re: unique constraint on two tables?

    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" <jerosimic@gmai l.comwrote in message
    news:1178387342 .966780.319330@ q75g2000hsh.goo glegroups.com.. .
    Is it possible to create a unique constraint on two tables?
    In mssql2000?
    >

    Comment

    • DA Morgan

      #3
      Re: unique constraint on two tables?

      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.wash ington.edu
      (replace x with u to respond)

      Comment

      • Dan Guzman

        #4
        Re: unique constraint on two tables?

        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" <marko.NOSPAMcu lo@gmail.comwro te in message
        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" <jerosimic@gmai l.comwrote in message
        news:1178387342 .966780.319330@ q75g2000hsh.goo glegroups.com.. .
        >Is it possible to create a unique constraint on two tables?
        >In mssql2000?
        >>
        >
        >

        Comment

        • Erland Sommarskog

          #5
          Re: unique constraint on two tables?

          Igor (jerosimic@gmai l.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@sommarsk og.se

          Books Online for SQL Server 2005 at

          Books Online for SQL Server 2000 at

          Comment

          • MC

            #6
            Re: unique constraint on two tables?

            You're right offcourse. Union is not allowed in indexed view. So, either
            redesign or programmatical checking...


            MC


            "Dan Guzman" <guzmanda@nospa m-online.sbcgloba l.netwrote in message
            news:lf6%h.222$ 4X.95@nlpi069.n bdc.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" <marko.NOSPAMcu lo@gmail.comwro te in message
            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" <jerosimic@gmai l.comwrote in message
            >news:117838734 2.966780.319330 @q75g2000hsh.go oglegroups.com. ..
            >>Is it possible to create a unique constraint on two tables?
            >>In mssql2000?
            >>>
            >>
            >>
            >

            Comment

            • Igor

              #7
              Re: unique constraint on two tables?

              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_finish ed 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 :)

              Comment

              • MC

                #8
                Re: unique constraint on two tables?

                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" <jerosimic@gmai l.comwrote in message
                news:1178545983 .249305.210700@ e65g2000hsc.goo glegroups.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_finish ed 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 :)
                >

                Comment

                Working...