DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2007
    Posts
    92

    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
    Posts
    163
    christianbg,

    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
    Posts
    92
    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

    Next

    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
    Posts
    1
    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, 10:58 PM
  2. Creating new row in .NET Data table
    By software_develo in forum .NET
    Replies: 1
    Last Post: 01-02-2006, 10: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, 08: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

Bookmarks

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links