Create Table from another Table

  • What would the T-SQL be for creating a new table that is identical to another table?

  • The way I do it is by using the old table script...changing all the names (table, contraints, keys etc..) to the new ones and then running it in QA...







    **ASCII stupid question, get a stupid ANSI !!!**

  • It all depends what you need this for but in case you want a temporary image:

    Select *

    into NEWTABLE

    from SOURCETABLE

    where 1=2

     

    Will do just that

     


    * Noel

  • Yes, of course...didn't even think that may have been the intention...just goes to show that the more "eyes" that look at something the more perspectives there are...







    **ASCII stupid question, get a stupid ANSI !!!**

  • We all have been there many times


    * Noel

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply