Copy structure and data of a table in SQL Server 2008

For copying structure and data both from another table in Sql Server 2008, you can execute the following sql query:

select * into newtablename from oldtablename

you don't need to create the new table before you execute the query. It will be created automatically after executing this. Refresh the object explorer and it will come automatically.

Comments

  1. That was really a helpful one...thanx buddy.

    ReplyDelete
  2. Do you know how to do with with constraints?

    ReplyDelete
  3. Did you try with import and export data tool from SQL Server 2008? You can easily do that with that tool.

    ReplyDelete

Post a Comment

Popular posts from this blog

html to Word Document Converter using Open XML SDK

How to: Get Top n Rows of DataView in C# asp.net