Results 1 to 5 of 5

Thread: Query

  1. #1
    Contributing Member
    Join Date
    Jan 2007
    Answers
    48

    Query

    How to create a new table from the existing table but the table created with the structure of existing table no data should be taken from existing table


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Query

    its so simple

    Code:
    create table newtable as select * from oldtable where 1=2;
    hope this solves your problem


  3. #3
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Query

    instead of using 1=2 in the SQL statment ,you can use any other expression which logically evalutes to FALSE.


  4. #4
    Junior Member
    Join Date
    Jun 2007
    Answers
    18

    Re: Query

    CREATE TABLE tablename
    AS
    SELECT * FROM tablename
    WHERE ( a cond that is returns 0 rows)


  5. #5
    Junior Member
    Join Date
    Aug 2007
    Answers
    7

    Re: Query

    If it is SQL Server Then Use INTO functions

    SELECT TOP 0 * INTO new_table_name FROM old_table_name


  6.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact