Here is how part of our database works. We have a table called "Events." Inside the "Events" table, we list various events which takes place for each of our clients. The first event for any client should be "Opened Case." However, some of my employees have not been listing this event so we do not know when the case was actually opened. In theory, all cases should have an "Opened Case" event in them. Is there a way to query that table to find which cases do not contain that event? Or is that more a programming issue? Thanks for any help?I'd suggest something like:SELECT DISTINCT caseID
FROM events AS a
WHERE NOT EXISTS (SELECT *
FROM events AS b
WHERE b.caseID = a.caseID
AND 'Case Opened' = b.eventType)
ORDER BY caseID-PatP|||or something like --select caseID
from events
group
by caseID
having 0
= sum(
case when eventType = 'Case Opened'
then 1 else 0
end ):)|||My, aren't we feeling deviant today! Heck, Rudy's solution will even work in MySQL!
-PatP|||deviant? heh
i was just thinking that yours involves a join (expensive), a NOT EXISTS (expensive), and a sort to remove dupes (expensive)
mine's just one sort, to do grouping
hey pat, did you give that Sock Hop channel a try? i was hoping you'd come back with some comment like "oh wow, i love that stuff!" (which was my reaction)sql
Showing posts with label events. Show all posts
Showing posts with label events. Show all posts
Friday, March 23, 2012
Wednesday, March 21, 2012
Listening for report events
I have a series of reports and want to fire off a stored procedure to update
a "Printed date" column in my database. I don't want to do this from the
dataset that populates my datset as I only want this to occur if the report
is successfully generated. Is there any way I can do this with the scheduler?
If not, are the any report events that I can listen for? And or any other
solution to this problem.Sorry. I don't think I made my intentions very clear. I meant to say that I
have a series of report, and want to fire off a stored procedure everytime a
report is successfully generated.
"Graham Hope" wrote:
> I have a series of reports and want to fire off a stored procedure to update
> a "Printed date" column in my database. I don't want to do this from the
> dataset that populates my datset as I only want this to occur if the report
> is successfully generated. Is there any way I can do this with the scheduler?
> If not, are the any report events that I can listen for? And or any other
> solution to this problem.
a "Printed date" column in my database. I don't want to do this from the
dataset that populates my datset as I only want this to occur if the report
is successfully generated. Is there any way I can do this with the scheduler?
If not, are the any report events that I can listen for? And or any other
solution to this problem.Sorry. I don't think I made my intentions very clear. I meant to say that I
have a series of report, and want to fire off a stored procedure everytime a
report is successfully generated.
"Graham Hope" wrote:
> I have a series of reports and want to fire off a stored procedure to update
> a "Printed date" column in my database. I don't want to do this from the
> dataset that populates my datset as I only want this to occur if the report
> is successfully generated. Is there any way I can do this with the scheduler?
> If not, are the any report events that I can listen for? And or any other
> solution to this problem.
Wednesday, March 7, 2012
List of Audit Events for SQLServer
The documentation on SQLServer (both books and online) seems to have treated this as a need-to-know item.
Can someone point me where I should be looking for a complete list of the audit events that SQLServer would spit out.
The list for Sybase is easily found when you do a search for "audit" but nothing comes up for SQLServer.
Thanks in advance!1 If you are looking for additional information on error messages (1 - 21999)?? browse the BOL Contents as follows:
BOL Contents:
Troubleshooting:
Error Message Descriptions:
Resolving System Error Messages:
Errors 1 - 999
...
Errors 21000 - 21999
2 If interested in c2 audit mode there are MS white papers pertaining to the subject.
3 If interested in auditing using profiler or traces there is some information on both in BOL and there are MS resources pertaining to both subjects, (however not all trace flags or results are documented to users).
(Unfortunatly, reference links for 2 & 3 have been moved.)
Can someone point me where I should be looking for a complete list of the audit events that SQLServer would spit out.
The list for Sybase is easily found when you do a search for "audit" but nothing comes up for SQLServer.
Thanks in advance!1 If you are looking for additional information on error messages (1 - 21999)?? browse the BOL Contents as follows:
BOL Contents:
Troubleshooting:
Error Message Descriptions:
Resolving System Error Messages:
Errors 1 - 999
...
Errors 21000 - 21999
2 If interested in c2 audit mode there are MS white papers pertaining to the subject.
3 If interested in auditing using profiler or traces there is some information on both in BOL and there are MS resources pertaining to both subjects, (however not all trace flags or results are documented to users).
(Unfortunatly, reference links for 2 & 3 have been moved.)
Subscribe to:
Posts (Atom)