More Group Sites
School Rankings
Jobless Net
Better Home
Enviro++


Help | Subscribe/Unsubscribe | Rules | Other Group Sites: Better Education | Better Education Forum
Welcome Guest Search | Active Topics | Members | Log In | Register

SQL how to copy table structure/schema Options · View
hong
Posted: Saturday, January 08, 2011 5:03:58 AM

Rank: Administration
Groups: Administration

Joined: 11/23/2008
Posts: 335
Points: 711
Location: Australia
The following SQL select query will copy the source table structure to the destination table:
Code:
select *
into <destination table>
from <source table>
where 1=0


Alternatively right click on the table in SQL Server Management Studio or Visual Studio, Select Script Table as > Create to > New Query Editor Window, change the the name of the source table to the destination table and modify the scripts if necessary (eg. select part of the fields to copy) and then run the query.
Sponsor
Posted: Saturday, January 08, 2011 5:03:58 AM
hydraulic
Posted: Friday, May 11, 2012 9:09:37 PM
Rank: Newbie
Groups: Member

Joined: 5/11/2012
Posts: 2
Points: 6
I do not know how to copy the structure of the table i knew how to copy a table in another table.The Script is as follows:-

select * from Source_table as selection destination_table


ebook reader reviews
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

ASPNET Theme created by Boskone (Dan Ferguson)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.
This page was generated in 0.065 seconds.