To Move The Entire Table Structure

  • Hai Friends;

    I need the following Structure of table ;

    i have to create a table like this, only structure are created

    SELECT * INTO tbl1FROM dbo.tbl2 WHERE 1=2,

    I need the entire thing like primary Key and Indexes are moved to the tbl1; it's poosible means pls any one to help me;

    Thanks;

    A.Faijurrahuman

  • The structure of the table is described in the system tables (sysobjects, syscolumns, sysindexes etc.) you can roll your own tsql to extract the information into "create table..." statements, or you can use some scripts other have already written. Its really not that hard to do, it mostly takes patience. You will learn a lot about SQL server by doing it yourself.

    The probability of survival is inversely proportional to the angle of arrival.

  • The easiest way is to use SSMS. Right-click on the table, select Script Table AS -> CREATE TO -> New QUery window. Then change the table name in the script.

Viewing 3 posts - 1 through 2 (of 2 total)

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