How to create table in existing database in sql


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: How to create table in existing database in sql

  1. #1
    Join Date
    May 2008
    Posts
    1

    How to create table in existing database in sql

    How can i check that a table exist in sql database or not at runtime, If not then create a table.

  2. #2
    Join Date
    Mar 2008
    Posts
    61
    To start with, I'm not 100% sure what you are asking. If you want to know how to see if a table exists in a database. Check out the following statements. I know little to nothing about MSSQL , but I used to be an Oracle DBA:

    MSSQL
    SELECT table_name FROM information_schema.columns;

    Oraacle
    select table_name from user_tables;

    Then to create a new table just use the create table statement.

    Bozo

  3. #3
    Join Date
    Aug 2005
    Location
    Hermosillo, Sonora, Mexico
    Posts
    103
    I use this in a MSSQL to see if a table exists in a db (replace TableX by your table name)

    Code:
    SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'dbo.TableX ') AND type in (N'U')
    Last edited by jggtz; 05-26-2008 at 12:22 PM.

Similar Threads

  1. Replies: 1
    Last Post: 01-28-2008, 02:18 PM
  2. Database not properly created
    By Arjuna in forum Database
    Replies: 2
    Last Post: 07-25-2007, 03:22 AM
  3. Replies: 4
    Last Post: 05-24-2005, 06:31 AM
  4. Attn: Daniel Reber
    By joe in forum Database
    Replies: 0
    Last Post: 04-04-2003, 05:25 PM
  5. Replies: 0
    Last Post: 08-15-2002, 09:57 AM

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


   Development Centers

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