Talk:Log trigger

New to Wiki editing. Thought about adding references to this otherwise okay article.

Talk:Log trigger

New to Wiki editing. Thought about adding references to this otherwise okay article.

"Database Fundamentals" by Nareej Sharma et. al. (First Edition, Copyright IBM Corp. 2010) for DB2 implementation "Microsoft SQL Server 2008 - Database Development" by Thobias Thernström et. al. (Microsoft Press, 2009) for SQL Server implementation

Also, consider adding a section on FileMaker implementation of Log trigger for tuple versioning as described in the "FileMaker Training Series For FileMaker Pro 11" (2010, FileMaker Inc.). Will include draft in this talk page. Look forward to everyones input and feedback. Thanks. Seehorse (talk) 16:20, 18 December 2011 (UTC)Reply

The last example is actually faulty and will return an empty results set. This query is supposed to return the first entry, but will actually return no results because it is a very inefficient way to return the row where StartDate IS NULL, but that doesn't exist.

SELECT H2.Column1, H2.Column2, ..., H2.Columnn, H2.StartDate
 FROM HistoryTable AS H2 LEFT OUTER JOIN HistoryTable AS H1
   ON H2.Column1 = H1.Column1
  AND H2.Column1 = @KEY
  AND H2.StartDate = H1.EndDate
WHERE H1.EndDate IS NULL

I think the query you were looking for would be.

SELECT H2.Column1, H2.Column2, ..., H2.Column, H2.StartDate
 FROM HistoryTable AS H2 
INNER JOIN
  (SELECT Column1, min(StartDate) as FirstDate 
    FROM HistoryTable 
    WHERE Column1=@KEY 
    GROUP BY Column1 ) AS H1
 ON H2.Column1 = H1.Column1
  AND H2.StartDate = H1.FirstDate

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.