Output Complete DDL

  • I would like to setup a job to automatically export the entire DDL for a DB to a file. I know how to do this through EM, but was wondering if there is a tool or something that would allow me to do this programatically. I traced the EM process while doing it, and it appears to invoke lots of things.

    Despite my dislike (OK, hatred) of UDB, this would be something like UDBs DB2LOOK command.

    KlK, MCSE


    KlK

  • There's a great freeware utility in the Products section, called "Bill Wunder's DDL Archive Utility". It is a standalone program that basically performs the same functions that EM does when you script the entire db. It is designed to archive the DDL scripts into VSS, but you don't have to use that part. You can just create the DDL scripts and stop there.

    There are some other utilities and scripts that produce DDL scripts, but I can't remember the names.

    Jay Madren


    Jay Madren

  • Declare @C Varchar(1000)

    Select @C='exec master..xp_cmdshell ''scptxfr.exe /s TheServername /d '+db_name()+' /f \\servername\x$\'+@@Servername+'_'+db_name()+'_'+

    Replace(convert(Varchar(8),getdate(),112)+'_'+convert(Varchar(8),getdate(),114),':','')+

    '.sql /r /O /H /G '''

    -- Exec (@c)

    Select @C

    ------------------

    "scptxfr.exe" is MS supplied.

    Replace the reference to drive X$ with your own.

    Can be scheduled as a job.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply