DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Creating a database Table From DataTable

  1. #1
    Join Date
    Jan 2007

    Creating a database Table From DataTable

    I have a live oracle database and test oracle database. i am copy data from my live to my test system, which doesnt have all of the current table that the live system has. so what i would like to do for a table that doesnt exist in my test system, is create a table in my test system from the datatable i created from my live system. is there a way to do this so that i can any indexes, triggers or any other objects that belong to that table?

  2. #2
    Join Date
    Dec 2004

    I believe that you will need to execute the appropriate DDL statements to create the table, indexes, etc. Those database objects will not get created automatically from data in a datatable.

    Kerry Moorman

  3. #3
    Join Date
    Jan 2007
    i am can write the DDL statements from properties on the datatable like i have done below:

    For Each localColumn As DataColumn In inDatatable.Columns
    Dim localField As String = ""

    localField = localColumn.ColumnName

    If localColumn.DataType.Equals(GetType(String)) Then
    localField = localField & " varchar2(" & localColumn.MaxLength & ")"
    ElseIf localColumn.DataType.Equals(GetType(Date)) Then
    localField = localField & " date"
    ElseIf localColumn.DataType.Equals(GetType(Integer)) Then
    localField = localField & " numeric"
    End If

    If Not localColumn.AllowDBNull Then
    localField = localField & " NOT NULL"
    End If


    i was curious to know if there was way to capture the index, relationships, triggers and all other objects, so that i could recreate those also.

  4. #4
    Join Date
    Apr 2011
    Thanx a lot christianbg..... i was finding this solution from long time b4 nd now i got it.... thnx again.....

Similar Threads

  1. How to delete table from Access 97 database table
    By software_develo in forum Database
    Replies: 1
    Last Post: 01-31-2006, 11:58 PM
  2. Creating new row in .NET Data table
    By software_develo in forum .NET
    Replies: 1
    Last Post: 01-02-2006, 11:43 PM
  3. Replies: 0
    Last Post: 08-15-2002, 09:57 AM
  4. Table relationships in Access database design-
    By Marcus Koontz in forum VB Classic
    Replies: 2
    Last Post: 03-30-2002, 09:03 AM
  5. Create a new table into Database by using VB coding
    By Sara Yen in forum VB Classic
    Replies: 1
    Last Post: 06-05-2000, 10:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center