Re: using lookup and display only field as control field
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Thu, 25 May 2006 17:10:21 +0000 (UTC)
(jim.murphy@xxxxxxxxxxxxxxxxxx) writes:
Thanks for reply . I believe there was a post from someone else here
on Informix lookups. At the moment just brainstorming so thought I
would try a post here and see what I could get. Perhaps someone has
done something similar. One idea was:
The control table would have only one row. Since there is no explicit
assosciation between the two tables if the key field was null in both
tables the date field in the control table could be looked up
Will see if I get anything from your suggestion
With a single-row table it's easy as I said. You would use a cross
join:
CREATE TRIGGER jimstrigger ON tbl AFTER INSERT, UPDATE AS
IF EXISTS (SELECT *
FROM inserted i
CROSS JOIN controltable c
WHERE i.date_enter <= c.controldate)
BEGIN
ROLLBACK TRANSACTION
RAISERROR ('Date_entered before controldate not permitted!, 16, 1)
RETURN
END
"inserted" is a virtual table that holds the inserted rows.
Of course, the syntax above is specific to SQL Server, but it's the
only RDBMS I know.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- using lookup and display only field as control field
- From: jim . murphy
- Re: using lookup and display only field as control field
- From: Erland Sommarskog
- Re: using lookup and display only field as control field
- From: jim . murphy
- using lookup and display only field as control field
- Prev by Date: Re: using lookup and display only field as control field
- Next by Date: Re: My boss beats me
- Previous by thread: Re: using lookup and display only field as control field
- Next by thread: Log shipping failover
- Index(es):
Relevant Pages
|
|