Generate Database Scripts using PowerShell

Last post 10-06-2009 1:12 PM by FileFoundException. 0 replies.

Sort Posts:

  • Generate Database Scripts using PowerShell

    10-06-2009, 1:12 PM

    Using windows powershell you can generate scripts for a database and its objects

    http://www.mssqltips.com/tip.asp?tip=1842&home

    here is a snippet from the article


    [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null
    $s 
    = new-object ('Microsoft.SqlServer.Management.Smo.Server') "LOCALHOST\SQL2005_1" 

    $dbs
    =$s.Databases

    $dbs["Northwind"].Script
    () 


    There are two ways to write error-free programs; only the third one works. ["Epigrams in Programming", by Alan J. Perlis]
Page 1 of 1 (1 items)