Find all missing records
Agreed Phil. At the enterprise level where you don't have control over all the software updating the database, triggers must be used for business rules enforcement.For new development or enhancement to...
View ArticleFind all missing records
Kalman, I disagree. Triggers are useful for enforcing business logic and audit trails. In this case, I don't think the OP can expect every user to use the OUTPUT clause. If a user forgets (or...
View ArticleFind all missing records
Thanks Phil,As a matter of fact, I have suggested to my boss to write a delete trigger to write the deleted record to another table for audit trail. In my assignment, I just need to display all the...
View ArticleFind all missing records
Thank you very much, Palmen, it works.I worked with 2000 before, but new to SQL 2005. I am not aware you can have SQL script starts with 'WITH'?, is this new feature in 2005? Would the same script work...
View ArticleFind all missing records
Yes, this is called a common table expression and it is a new feature in SQL Server 2005. In a way very similar to derived tables but more powerful (you can use prior defined CTE in the next one, like...
View ArticleFind all missing records
Thanks Phil,As a matter of fact, I have suggested to my boss to write a delete trigger to write the deleted record to another table for audit trail. In my assignment, I just need to display all the...
View ArticleFind all missing records
Thank you very much, Palmen, it works.I worked with 2000 before, but new to SQL 2005. I am not aware you can have SQL script starts with 'WITH'?, is this new feature in 2005? Would the same script work...
View ArticleFind all missing records
There is no 100% accurate way to do what you want if you are not currently using triggers or some other method (like switching a flag to "deleted" in the row for a given record).Identity values are not...
View ArticleFind all missing records
The easiest method is to use table with numbers. Here is example:CREATE TABLE Foo ( keycol INT NOT NULL PRIMARY KEY); INSERT INTO Foo VALUES(1); INSERT INTO Foo VALUES(5); INSERT INTO Foo VALUES(8);...
View ArticleFind all missing records
Hi, I need to find out all the deleted records in a table, and am thinking about writing a store procedure to do it and get stuck. Please help me out.We have a SQL 2005 table which the PK is an...
View Article