KEMBAR78
95 Audit Table Changes in SQL Server | PDF | Language Integrated Query | Microsoft Sql Server
0% found this document useful (0 votes)
32 views4 pages

95 Audit Table Changes in SQL Server

This document is a video tutorial on auditing table changes in SQL Server using DDL triggers. It provides a step-by-step guide on creating an audit table and a trigger to log changes such as table creation, alteration, and deletion. The tutorial is part of a broader series aimed at teaching .NET and SQL Server to beginners and intermediate programmers.

Uploaded by

realayoola007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views4 pages

95 Audit Table Changes in SQL Server

This document is a video tutorial on auditing table changes in SQL Server using DDL triggers. It provides a step-by-step guide on creating an audit table and a trigger to log changes such as table creation, alteration, and deletion. The tutorial is part of a broader series aimed at teaching .NET and SQL Server to beginners and intermediate programmers.

Uploaded by

realayoola007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

3/12/2023 Sql server, .

net and c# video tutorial: Audit table changes in sql server


The Wayback Machine - https://web.archive.org/web/20211209065904/https://csharp-video-tutorials.blogspot.com/2015/09/audit-table-change…

Sql server, .net and c# video tutorial


Free C#, .Net and Sql server video tutorial for beginners and intermediate programmers.

Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Audit table changes in sql server

Suggested Videos
Part 92 - DDL Triggers in sql server
Part 93 - Server-scoped ddl triggers
Part 94 - SQL Server trigger execution order

Pragim Technologies - Best software


training and placements in marathahalli,
bangalore. For further details please call
09945699393.

Complete Tutorials
How to become a full stack web
developer

Cloud computing complete tutorial

In this video we will discuss, how to audit table changes in SQL Server using a DDL Healthy food for healthy mind and
trigger. body

JavaScript tutorial

Bootstrap tutorial

Angular tutorial for beginners

Angular 5 Tutorial for beginners

https://web.archive.org/web/20211209065904/https://csharp-video-tutorials.blogspot.com/2015/09/audit-table-changes-in-sql-server.html 1/4
3/12/2023 Sql server, .net and c# video tutorial: Audit table changes in sql server

Important Videos
The Gift of Education

Web application for your business

How to become .NET developer

Resources available to help you

Dot Net Video Tutorials


Blazor tutorial

C tutorial

ASP.NET Core Tutorial


Table to store the audit data
Create table TableChanges ASP.NET Core Razor Pages Tutorial
(
DatabaseName nvarchar(250), Angular 6 Tutorial
TableName nvarchar(250),
EventType nvarchar(250), Angular CRUD Tutorial
LoginName nvarchar(250),
Angular CLI Tutorial
SQLCommand nvarchar(2500),
AuditDateTime datetime Angular 2 Tutorial
)
Go Design Patterns

The following trigger audits all table changes in all databases on a SQL Server SOLID Principles
CREATE TRIGGER tr_AuditTableChanges
ON ALL SERVER ASP.NET Web API
FOR CREATE_TABLE, ALTER_TABLE, DROP_TABLE
Bootstrap
AS
BEGIN AngularJS Tutorial
DECLARE @EventData XML
SELECT @EventData = EVENTDATA() jQuery Tutorial

INSERT INTO SampleDB.dbo.TableChanges JavaScript with ASP.NET Tutorial


(DatabaseName, TableName, EventType, LoginName,
SQLCommand, AuditDateTime) JavaScript Tutorial
VALUES
Charts Tutorial
(
@EventData.value('(/EVENT_INSTANCE/DatabaseName)[1]', 'varchar(250)'), LINQ
@EventData.value('(/EVENT_INSTANCE/ObjectName)[1]', 'varchar(250)'),
@EventData.value('(/EVENT_INSTANCE/EventType)[1]', 'nvarchar(250)'), LINQ to SQL
@EventData.value('(/EVENT_INSTANCE/LoginName)[1]', 'varchar(250)'),
@EventData.value('(/EVENT_INSTANCE/TSQLCommand)[1]', 'nvarchar(2500)'), LINQ to XML
GetDate()
) Entity Framework
END
WCF

In the above example we are using EventData() function which returns event data in ASP.NET Web Services
XML format. The following XML is returned by the EventData() function when I created
a table with name = MyTable in SampleDB database. Dot Net Basics

<EVENT_INSTANCE> C#
<EventType>CREATE_TABLE</EventType>
<PostTime>2015-09-11T16:12:49.417</PostTime> SQL Server
<SPID>58</SPID>
ADO.NET
<ServerName>VENKAT-PC</ServerName>
<LoginName>VENKAT-PC\Tan</LoginName> ASP.NET
<UserName>dbo</UserName>
<DatabaseName>SampleDB</DatabaseName> GridView
<SchemaName>dbo</SchemaName>
<ObjectName>MyTable</ObjectName> ASP.NET MVC
<ObjectType>TABLE</ObjectType>
<TSQLCommand> Visual Studio Tips and Tricks
<SetOptions ANSI_NULLS="ON" ANSI_NULL_DEFAULT="ON"
Dot Net Interview Questions
ANSI_PADDING="ON" QUOTED_IDENTIFIER="ON"
ENCRYPTED="FALSE" />
Slides
https://web.archive.org/web/20211209065904/https://csharp-video-tutorials.blogspot.com/2015/09/audit-table-changes-in-sql-server.html 2/4
3/12/2023 Sql server, .net and c# video tutorial: Audit table changes in sql server
<CommandText> Entity Framework
Create Table MyTable
( WCF
Id int,
Name nvarchar(50), ASP.NET Web Services
Gender nvarchar(50)
) Dot Net Basics
</CommandText>
C#
</TSQLCommand>
</EVENT_INSTANCE> SQL Server

ADO.NET

ASP.NET

GridView

ASP.NET MVC

Visual Studio Tips and Tricks

Java Video Tutorials


Part 1 : Video | Text | Slides

Part 2 : Video | Text | Slides

Part 3 : Video | Text | Slides

2 comments: Interview Questions


C#
Unknown September 27, 2015 at 6:05 PM
SQL Server
How do we find that trigger in the DB? How do we delete/alter that trigger?
Written Test
Reply

Gangadhar June 4, 2016 at 6:46 AM


There are two kinds of triggers. Server Scoped and Individual Database Scoped
Triggers. If you want to check the Sever Scoped Triggers go for ServerObjects ->
Triggers. If you want to check Individual Database Triggers go for that respective
database -> Programmability -> Database Triggers..
Reply

It would be great if you can help share these free resources

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

Powered by Blogger.

https://web.archive.org/web/20211209065904/https://csharp-video-tutorials.blogspot.com/2015/09/audit-table-changes-in-sql-server.html 3/4
3/12/2023 Sql server, .net and c# video tutorial: Audit table changes in sql server

https://web.archive.org/web/20211209065904/https://csharp-video-tutorials.blogspot.com/2015/09/audit-table-changes-in-sql-server.html 4/4

You might also like