Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #509
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!news.xs4all.nl!not-for-mail |
|---|---|
| Message-ID | <4E1DD860.5CE2D6C7@xs4all.nl> (permalink) |
| Date | Wed, 13 Jul 2011 19:39:44 +0200 |
| From | Gert-Jan Strik <sorrytoomuchspamalready@xs4all.nl> |
| Reply-To | sorry@toomuchspamalready.nl |
| X-Mailer | Mozilla 4.79 [en] (WinNT; U) |
| X-Accept-Language | en |
| MIME-Version | 1.0 |
| Newsgroups | comp.databases.ms-sqlserver, microsoft.public.sqlserver.programming |
| Subject | Re: SSE 2008: Referring to Other Rows Being Added |
| References | <cpap17l6g8qsntt5703ja4m6mr8osq287i@4ax.com> |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Lines | 41 |
| NNTP-Posting-Host | 82.95.107.10 |
| X-Trace | 1310578784 news2.news.xs4all.nl 23864 82.95.107.10:11988 |
| Xref | x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:509 |
Cross-posted to 2 groups.
Show key headers only | View raw
A simple/simpler solution would be to always sort the values. In other words, to enforce that A is always lower or equal to B, both in the table and whenever you do inserts. That way you don't need two rows for each pair. In the table, this can be enforced with CHECK (a <= b) -- Gert-Jan Gene Wirchenko wrote: > > Dear SQL'ers: > > How do I force a condition based on multiple rows? I want the > necessary rows to be entered in a batch. As a simple example, what > would be the coding of the constraint in this case following? > > create table Symmetric > ( > a int not null, > b int not null > ) > > Constraint: If (x,y) is in Symmetric, then (y,x) is also in > Symmetric. > > Anyone adding rows would have to do it in a batch: > insert into Symmetric > (a,b) > values > (3,5), > (5,3) > > I am hoping that there is a simple answer that I am overlooking. > Right now, all I can think of is to scan both Symmetric and the batch > (Inserted). > > Sincerely, > > Gene Wirchenko
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar
SSE 2008: Referring to Other Rows Being Added Gene Wirchenko <genew@ocis.net> - 2011-07-12 13:20 -0700
Re: SSE 2008: Referring to Other Rows Being Added Erland Sommarskog <esquel@sommarskog.se> - 2011-07-12 23:55 +0200
Re: SSE 2008: Referring to Other Rows Being Added Gene Wirchenko <genew@ocis.net> - 2011-07-12 15:37 -0700
Re: SSE 2008: Referring to Other Rows Being Added Erland Sommarskog <esquel@sommarskog.se> - 2011-07-13 10:16 +0200
Re: SSE 2008: Referring to Other Rows Being Added Gert-Jan Strik <sorrytoomuchspamalready@xs4all.nl> - 2011-07-13 19:39 +0200
Re: SSE 2008: Referring to Other Rows Being Added Gene Wirchenko <genew@ocis.net> - 2011-07-13 12:14 -0700
csiph-web