January 16, 2015 at 9:54 am
Hey All,
This is my first attempt at creating a trace, and i'm having trouble finding documented steps online to point me in the right direction.
I have an agent job in place that updates a value by comparing it to what's listed on a different table. I'm looking to deploy a trace to confirm that the correct data is being modified after the job runs.
The tables included in the job are an orderheader table, a company table and a invoiceheader table. Each table has 2 PKs in common being the Order# and the Customer Code. The value being modified is the Currency Type( USD$ or CAD$) which is a varchar datatype. The job runs 2 separate updates; 1 compared to the company table and 1 compared to the invoiceheader table. Whenever the currency value is Null or <> to the value in the compared table, it changes it to that value.
From what i've read i understand that this would be done through SQL Profiler? I'm still not sure as when i display all events, it doesn't seem to be granular enough to trace specific tables or columns.
I was able to get a trace to log logins and user transactions, but it uses the default template so not much was changed.
January 19, 2015 at 2:21 pm
Bump,
January 19, 2015 at 5:40 pm
It sounds more like you want "auditing" than a trace.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 20, 2015 at 7:52 am
I'm sure there's more than 1 to do it, but yes we want to be able to audit this data and also update it where those constraints fit.
Ex, if an OrderID with company A has a destination going to x1 to y1, then the office account on it is Z. At the same time, if company A has a destination from x1 to y3, then nothing happens. Whenever it's x1 to y1 then the account should be Z, otherwise it's left alone and is not audited.
January 20, 2015 at 7:57 am
profiler/trace/extended events tell you what commands were executed, but not what data changed.
an audit can tell you that a value changed.
the best way to handle it is of course at the source of the change itself...
since there is already a job that is doing the changes in your tables, why can you not add the additional logic to that job?
if you need to handle it after the fact, you need to have the ability to compare old vs new values, which means a trigger, or Change Tracking + a history table or Change Data Capture(enterprise editing required)
Lowell
January 20, 2015 at 8:33 am
Maybe it will help if i explain it this way.
In terms of what comes first, i would need a job to run periodcally ( Every 10 minutes or so) that will update the data(Orderheader) based on the description i posted above. After the fact, i want the same job to insert those rows in a table format that would get backed up and logged with all other tables. There would likely be relationships( I haven't gotten to that part yet...) between this new table and existing table so we could pull reports with that info.
I'd like to try creating the update job myself, but i don't have many options concerning logging or temp tables, so i'm not sure what the best approach would be.
EDIT: Sorry, just re-read the last part of your post; That sounds exactly like what i need.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply