Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

MS SQL

Posted Aug 24, 1999

Automated Database Schema Scripting (DMO) - Page 7

By Bill Wunder

This represents the basic access method to the DMO object model.
Connect -> Access Object Model -> Disconnect

CREATE procedure dmoScriptServer
  @serverName varchar(30) ,
  @outputPath varchar(255) ,
  @style bit = 0
as
declare @dmoServer int

-- Check for trailing slash on backup location param
if (substring(@outputPath, len(@outputPath), 1) <> '\') 
  begin
    set @outputPath = @outputPath + '\'
  end

/* connect to the server where database to be scripted lives */
exec dmoConnectServer @serverName, @dmoServer OUT

if @dmoServer > 0
  begin
    exec dmoScriptServerCollection @serverName, @dmoServer, 'Logins',@outputPath, @style
    exec dmoScriptServerCollection @serverName, @dmoServer, 'Jobserver.Jobs',@outputPath, @style

/* the DMO database scripter is broken. Does not produce useable scripts and may blow up in some situations. 
  An alternate database scripter uses a non dmo routine to script each individual database 
  and it is called from inside the database via dmoScriptDatabase*/    
--    exec dmoScriptServerCollection @serverName, @dmoServer, 'Databases',@outputPath, @style

    exec dmoDisconnectServer @dmoServer
  end



MS SQL Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM


















Thanks for your registration, follow us on our social networks to keep up-to-date