Generate SQL Scripts

  • Hi !

    Is there any statement or stored procedure to help me Generating SQL Scripts without using SQL Server Enterprise Manager ?

    I need all the information... tables, columns, triggers, views, stored procedures...

    Please help,

    TIA

    Pedro Martins

    Rechousa,

    V.N.Gaia

    Portugal


    Rechousa,
    V.N.Gaia
    Portugal

  • Why not use EM?

    You can use DMO, but that is what EM uses.

    You can also use DTS.

    Steve Jones

    steve@dkranch.net

  • Use SQLDMO and generate scripts.

    sub GenerateScript(TableName as string)

    dim objServer As New SQLDMO.SQLServer

    objServer.Connect Trim(gstrServerName), Trim(gstrUserName), Trim(gstrPassword)

    'this would generate a file called <tablename>.sql

    objServer.Databases(gstrDatabase).Views(TableName).Script SQLDMOScript_Default + SQLDMOScript_Drops, Trim(gstrScriptFolder) + "\" + Trim(TableName) + ".sql"

    objServer.disconnect

    set objserver = nothing

    end sub

    Give me a fish, you feed me for a day! Teach me to fish, you feed me for a life time.

  • There's an example-application on this issue shipped with sql-server.

    check "C:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Samples\sqldmo"

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

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

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