Hi Mark,
Like Jhofm says, I wouldn't use a trigger too.
But in a similar situation (ie, employee bookings froma db to a flat
file every 30 minutes) I use a column in the source table. There I
insert/update a simple 3 state Flag instead of a date field (which can
be useful indeed). Eg: 1 for 'To be processed', 2 for 'in processing'
and 3 for 'processed'.
Then, at the top of your DTS you would attach a Simple Execute sql
task that performs an update of the status flag from 1 (every newly
inserted column must have this value, this can easily be done, as
stated by J., with the default value feature) to 2. And only when the
file has been created or more easily at the end of your DTS create
another Execute SQL task that updates this flag from 2 to 3.
When you SELECT the data to be transferred you have to bear in mind to
SELECT * FROM yourSourceTable WHERE StatusFlag IN (1,2)
The main advantage is that if the process fails once, twice, etc, the
next time it runs it will surely "pick up" all the data of the
previous failed executions (that should remains flagged as 2).
Sorry for bad english.
Hope this helps ;)
M.
Griff5w - 21 Jul 2008 17:28 GMT
> Hi Mark,
>
[quoted text clipped - 18 lines]
> Hope this helps ;)
> M.
I have a similar situation, however, I don't have the option of adding
columns to the tables. I have created an ugly process of comparing a
text file to the source table to see what is new, then spit changes to
a csv, and then append that csv to the original 'master' csv. Really
ugly. If there is a better way of doing this, please, please share.
Thanks,
Aaron
matteus - 22 Jul 2008 10:47 GMT
> I have a similar situation, however, I don't have the option of adding
> columns to the tables. I have created an ugly process of comparing a
[quoted text clipped - 4 lines]
> Thanks,
> Aaron
Hi Aaron,
I miss something... can you please explain us how the process should
work or what is your need?
Do you need to compare a text file with a source table (source of the
text file?) and then insert new records (and updated ones?) into
a .csv file?
Bye,
M.
Griff5w - 30 Jul 2008 18:44 GMT
> > I have a similar situation, however, I don't have the option of adding
> > columns to the tables. I have created an ugly process of comparing a
[quoted text clipped - 14 lines]
> Bye,
> M.
M.
I created a 'master' csv dump of the table. Now, once a day I check
the records in the master csv against the table. Any records in the
table that are not in the csv, get copied to a temp csv. A copy of
the temp csv is sent to me via mail. Then the records in the temp csv
are copied to the master csv.
I am just trying to find a better process to get a daily update.
matteus - 31 Jul 2008 17:10 GMT
> > > I have a similar situation, however, I don't have the option of adding
> > > columns to the tables. I have created an ugly process of comparing a
[quoted text clipped - 24 lines]
>
> I am just trying to find a better process to get a daily update.
Aaron if you need to track down new/updated rows of a table you can
build a trigger (ON INSERT/ON UPDATE) to copy your newly inserted/
updated row into another table.
If the table has a lot of traffic during the day and/or because of
trigger can slow down on-line operations, you might consider building
a process that lets you know as a daily basis what changed in this
table.
For simplicity I'm going to consider relevant only newly inserted rows
and not also updated ones. Doing so the whole can be (very) much
easier... If so, let me know if this might fit your needs:
[If you can create a sort of backup table in the same DB and use it to
track down changes, well... that'll be great and much more
convenient].
Whatever the format of the dump (table or file), I would completely
refresh it every day, instead of going crazy to see what rows are
changed or added.
So let's say one day you'll start with the dump and the table,
identical. During the day the table does grow in rows, and so doesn't
the dump. At the end of the day you can run your process and in it I
would:
- select the differences between the dump (D) and table (T) with a
outer join
- copy the result into a csv and send a mail with this csv attached
- rebuild the dump from the original table
And so on the day after...
M.