Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Need SQL script

Posted on 2005-03-25
Medium Priority
Last Modified: 2010-04-23
I have to rebuild my tables empty (+/- 100,MSDE) on another site, using a script but I don't want to type them all out using T-SQL statement (CREATE TABLE etc), is there an easy way to do this ?


Question by:Strategus
LVL 25

Accepted Solution

RonaldBiemans earned 1840 total points
ID: 13629908
you can let VB.net create the  script for you.


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim objDMO As SQLDMO.SQLServer
        objDMO = New SQLDMO.SQLServer
        objDMO.loginsecure = True

        Dim objDB As SQLDMO.Databases
        objDB = objDMO.Databases

        Dim oTable As SQLDMO.Table
        For Each oTable In objDB.Item("YOURDATABASENAME").Tables
                TextBox1.Text += oTable.Script
    End Sub

this will make the CREATE TABLE Scripts for you.

you must reference the SQLDMO com object , (choose add reference, com tab, then locate SQLDMO)


Author Comment

ID: 13629925
I'll give it a try

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month11 days, 12 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question