Monday, March 19, 2012
database audit
joeTriggers can record inserts, updates, and deletes, but not reads (selects).
You either need to log this activity through stored procedures used to access the data, or turn on SQL Profiler.|||Nope, you need a trigger
http://weblogs.sqlteam.com/brettk/archive/2004/10/20/2242.aspx
Saturday, February 25, 2012
Data Versioning Transactional Replication
I've got a requirement to know when some data has been propagated to
all my (read-only) subscribers. This is because the data will be
cleaned, and the subscribers shouldn't "use" the new version for
certain queries until I know that the new data is there.
I've created a model where I have a "version" table with an identity,
that gets updated by the log reader every time it reads. I check the
version at the time the data changes are finished. Then, when i save
the version with the query that i want to run at the subscriber, and
wait until the version number is greater than or equal to my version
number.
This model seems to work, it requires me to add some steps to the
distribution job, but I'm wondering if there is a better way? Ie,
some form of replication that doesn't require me to custom code the
versioning scheme of the data.
Thx,
Doug
If the data is updated on the publisher in discrete batches you can always
wait for the distribution agent to complete. Other than that the scheme you
have implemented sounds like the best way to go. SQL 2005 will have tracer
tokens that might help with your requirement.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Douglas Tarr" <douglas.tarr@.gmail.com> wrote in message
news:c33eac8b.0409070825.1654dcb3@.posting.google.c om...
> Hi,
> I've got a requirement to know when some data has been propagated to
> all my (read-only) subscribers. This is because the data will be
> cleaned, and the subscribers shouldn't "use" the new version for
> certain queries until I know that the new data is there.
> I've created a model where I have a "version" table with an identity,
> that gets updated by the log reader every time it reads. I check the
> version at the time the data changes are finished. Then, when i save
> the version with the query that i want to run at the subscriber, and
> wait until the version number is greater than or equal to my version
> number.
> This model seems to work, it requires me to add some steps to the
> distribution job, but I'm wondering if there is a better way? Ie,
> some form of replication that doesn't require me to custom code the
> versioning scheme of the data.
> Thx,
> Doug
Friday, February 24, 2012
data type to store time
Hi all ,
What datatype should I take to store time in a table -- datetime , float or decimal?
my requirement is to store "Worked Hours in a day by an employee" in the field say, 9 hrs and 30 mins.
I should be able to manipulate data in this field such as total hours present in the month, extra hours worked in a day (considering 9 hrs as standard time),less hours worked in a day, and so on
I would suggest the builtin DATETIME datatype. The advantage of this datatype is that it gives you the ability to directly use the builtin functions that come with TSQL.|||As Kent indicated, using a datetime is most likely the best option. Yes, it will put the default date of Jan 1st, 1900, but you are interested in the hours.
You will be able to use datetime math functions, AND you don't have to remember to convert 20 minutes to .333333 hr, etc.
IF you are not concerned with seconds and milliseconds, you might consider a smalldatetime datatype.
|||Thanks Kent and Arnie for the quick response. I 'm new to this forum and sql server. Hope many more responses from you guys