• I don't know if it will work in 2005, but to script everything in all of your databases the following command works great for me:

    execmaster..sp_MSforeachdb "exec master..sp_ScriptDatabase ?"

    Source code for the script:

    CREATEproc sp_ScriptDatabase @dbname sysname

    as

    declare @command varchar(1000)

    declare @texttime varchar(10)

    set@texttime = convert(varchar, getdate(), 102)

    set@command = '"C:\Program Files\Microsoft SQL Server\MSSQL\Upgrade\scptxfr.exe" /s IDEV /I /q /G /d ' + @dbname + ' /f d:\BACKUPightly1\'+LTRIM(RTRIM(@@SERVERNAME))+'_' + @dbname + '_' + @texttime + '.txt /r'

    print@command

    exec master..xp_cmdshell @command

    GO

    This will create a file for each of your databases that has all of the objects scripted.

    I would suggest all dbas implement this script into their nightly processes. I then zip up all the files into one zip file. Presto! I have a daily history of the schemas of all of my databases.

    If this does work in 2005, please post that it does. My 2005 test server is down at the moment, so I can't test it. (Yes, we are still on 2000)


    Live to Throw
    Throw to Live
    Will Summers