Groups | Blog | Home
all groups > sql server data mining > october 2004 >

sql server data mining : How to create table from existing table structure?


Alejandro Mesa
10/14/2004 11:11:04 AM
You can use SELECT ... INTO to create a similar table without CONSTRAINTS.

Example:

use northwind
go

create table t (colA int not null identity(1, 1) unique)

select * into t1 from t

execute sp_help t
execute sp_help t1

drop table t, t1
go



AMB

[quoted text, click to view]
Rick Sawtell
10/14/2004 11:12:16 AM
Open QA,

Find table and right-click on it.

Chose script to new window as CREATE.

Modify the tablename in the new window. (Note: Ensure that you are in the
correct database)

Execute new query.

Rick Sawtell
MCT, MCSD, MCDBA


[quoted text, click to view]

Sunny
10/14/2004 12:59:51 PM
I have a table name Trxs, now I would like to create another table
TrxHistory which should have exact same structure as Trxs. I want to create
this table in the same database. Can anyone suggest me quick way?

Thanks.

sql beginner
10/15/2004 8:56:23 AM
maybe you should open your enterprice manager and select this table and then
right-click on table select copy
now you open somekind query and you paste it rename create [tablename] and
run it in base where do you want
now you have it

Veiko

[quoted text, click to view]

Hari Prasad
10/17/2004 11:09:35 AM
Hi,

You could execute the below command:-

select * into TrxHistory from Trxs where 1 =2

You will have create the dependant objects manually.
--
Thanks
Hari
SQL Server MVP

[quoted text, click to view]

AddThis Social Bookmark Button