Solved

Log File for Drop and Create Table

Posted on 2014-03-17
8
304 Views
Last Modified: 2014-04-13
I have many Drop and Create Table/ Views statements that I need to automate and log into a file when I run the script. Basically, I need to create a Log file for that will Log all the Drop and Create tables statements and will give me a status of the operation after the SQL statements have been run.

Any help on this issue is appreciated.
0
Comment
Question by:Rdichpally
  • 5
  • 2
8 Comments
 
LVL 39

Expert Comment

by:lcohan
ID: 39934964
I suggest you add a DDL Database Trigger and that will log into a table all the operations you need on DROP/CREATE/ALTER any SQL object in that database.

http://technet.microsoft.com/en-us/library/ms186406(v=sql.105).aspx

"SQL Server DDL Triggers to Track All Database Changes"
http://www.mssqltips.com/sqlservertip/2085/sql-server-ddl-triggers-to-track-all-database-changes/


I also suggest you right click your database in SSMS and check the standard report "Schema change history" for that same matter
0
 

Author Comment

by:Rdichpally
ID: 39935137
I need to create a log file when I run my DDL statements. I basically need a script for creating log files for a bunch of DDL Statements (Drop and Create tables). Thanks.
0
 
LVL 39

Expert Comment

by:lcohan
ID: 39935293
"I need to create a log file when I run my DDL statements"

The DDL database trigger example I posted above has ALL the code for you and it populates a log table already from where you can create your "log files" whatever those would be. To be honest I'm not sure what easier and better solution than this to LOG all DDL changes you need?

"The approach is to take a snapshot of the current objects in the database, and then log all DDL changes from that point forward. With a well-managed log, you could easily see the state of an object at any point in time (assuming, of course, the objects are not encrypted)."
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Accepted Solution

by:
Rdichpally earned 0 total points
ID: 39970747
I've requested that this question be closed as follows:

Accepted answer: 0 points for Rdichpally's comment #a39935137

for the following reason:

No Solution
0
 

Author Comment

by:Rdichpally
ID: 39970748
No Solution suggested for the issue
0
 

Author Comment

by:Rdichpally
ID: 39979952
I've requested that this question be closed as follows:

Accepted answer: 0 points for Rdichpally's comment #a39970748

for the following reason:

There was no solution suggested for my request that solves my issue
0
 

Author Closing Comment

by:Rdichpally
ID: 39997112
No Valid solutions for my issue
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SLQ View not updating 10 47
PHP loop not working 4 32
SQL Date Retrival 7 27
MySQL left join performance 4 12
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
A short article about problems I had with the new location API and permissions in Marshmallow
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now