Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2008 > SQL Server 2008
|
SQL Server 2008 General discussion of SQL Server *2008* version only - not related to a specific book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2008 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2012, 09:38 PM
Authorized User
 
Join Date: Jun 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need to Log Data changes in readable format

Hello,

I need to find a way to log data changes that are being made in our database. From the reading I've done online I need to turn on the system stored procedure for change data capture (sys.sp_cdc_enable_db), but I only have the standard edition of SQL Server 2008 R2. Which I've found requires the Enterprise or Developer editions to run.

Does anyone have a work around or an alterative for this?

Any help would be greatly appreciated.

Thank you!
David92595
 
Old February 23rd, 2012, 02:24 AM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile

Hi there.
you can use triggers:

Code:
CREATE TRIGGER Logger1
     ON Table1
     AFTER INSERT, UPDATE 
AS 

INSERT INTO tblLog (tableName, date, fieldName, fieldValue)
VALUES ('Table1', GetDate(), 'field1', INSERTED.field1);

GO
where Table1 and tblLog are your own tables:
Table1's Columns: ...,Field1,...
tblLog's Columns: ...,tableName, date, fieldName, fieldValue, ...
__________________
happy every time, happy every where

Reza Baiat





Similar Threads
Thread Thread Starter Forum Replies Last Post
web.config is still readable after compiling!? mzsohi BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 September 13th, 2009 07:30 AM
Converting enumerated value to readable value maigoro ASP.NET 3.5 Basics 2 April 11th, 2008 09:46 AM
zxml.js - is there a readable copy available? bobwazz BOOK: Professional Ajax ISBN: 978-0-471-77778-6 3 May 17th, 2007 09:21 AM
WordML to readable XML ROCXY XSLT 1 December 22nd, 2006 08:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.