Results 1 to 5 of 5

Thread: create table as

  1. #1
    Join Date
    May 2004
    Posts
    16

    Post Unanswered: create table as

    I want to create table from
    selecting records from another table In sql server 7.0
    e.g
    create table tablename
    as
    select * from another table/view.
    How is it possible ??

    Thanx in Advance.

  2. #2
    Join Date
    Mar 2004
    Posts
    20
    Hi To create a new table use

    SELECT *
    INTO fred
    FROM bill
    IT will fail if fred already exists


    To empty and reuse then use

    Truncate fred
    INSERT INTO fred
    SELECT *
    FROM bill

    Did I get the question right ?

    Gerry

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by dbtechzala
    I want to create table from
    selecting records from another table In sql server 7.0
    e.g
    create table tablename
    as
    select * from another table/view.
    How is it possible ??

    Thanx in Advance.

    WOW, you sound like a DB2 person...

    Just don't use SELECT * if it's for Production......
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Mar 2004
    Posts
    20
    Quite right about the "*" of course... I'm just a lazy typer

    As for the DB2 guess:- not even close !

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Gerry, not you....dbtechzala

    The syntax is close to a DB2 syntax.....

    Be careful of the TRUNCATE though....it'll mark every page as being deleted...

    no where clause there.....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •