Solved

Log File for Drop and Create Table

Posted on 2014-03-17
8
307 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

825 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