Link to home
Start Free TrialLog in
Avatar of nbkd72e
nbkd72e

asked on

How to reverse-engineer the DDLs of all database objects with a script?

I need a mechanism which could be executed in a script (either Windows or UNIX) to generate the DDLs of re-creating all DB objects (tables, views, stored procedures etc.) in a given SQL Server 2008 database.

Any suggestion?
SOLUTION
Avatar of JestersGrind
JestersGrind
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nbkd72e
nbkd72e

ASKER

As I mentioned in the question, I need a mechanism which could be executed in a script, without human intervention.
SOLUTION
Avatar of Som Tripathi
Som Tripathi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nbkd72e

ASKER

SMO sounds like a promising solution. Yes, code would be very helpful.
I can write code for you, but it might take time. you can read the article below and help yourself -

http://philergia.wordpress.com/2011/02/28/using-powershell-and-smo-to-script-sql-server-database-objects-3/u
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nbkd72e

ASKER

Thanks folks. Now I have enough information to start with my solutions, probably powershell + SMO. It would be even better if SMO has a Java interface.