Solved

Log File for Drop and Create Table

Posted on 2014-03-17
8
313 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 40

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 40

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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

687 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