Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    4

    Unanswered: Query analyzer --Temp tables

    Is there a quick way to create a temp table that is the same as an existing table in the schema? I am used to Informix where "select * from <table A> into temp B" would create the temp table B with the same schema is table A. Is this same functionality available with MS SQL server using query analyzer?

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Code:
    SELECT * INTO newTable FROM OldTable
    It doesn't bring over anything except the table structure and data. No indexes, triggers, primary or foreign keys....

    If you want the table and no data

    Code:
    SELECT * INTO newTable FROM OldTable WHERE 1=0
    Do you have SQL Server Client tools installed? You need to get books Online (BOL)...it has all the answers...
    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.

  3. #3
    Join Date
    Sep 2003
    Posts
    4
    Perfect, thank you!

Posting Permissions

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