Tuesday, March 27, 2012

copy fields of one table to the field structure of another table

How can I copy fields (not records) from one table to the field structure of
another table (in the same database on a sql server 2000)? So that I have
not to re-type the name and properties of the fields and to be sure the name
and properties of the fields are the same in both tables.
Thanks,
HugoScript Table definition and create new table with different name.
In Query Analizer right click on table -> Script Object to New Window As ->
Create. Type new name for table and run script.
"Educo Gent" wrote:

> How can I copy fields (not records) from one table to the field structure
of
> another table (in the same database on a sql server 2000)? So that I have
> not to re-type the name and properties of the fields and to be sure the na
me
> and properties of the fields are the same in both tables.
> Thanks,
> Hugo
>
>|||SELECT * FROM SourceTable
Into DestinationTable WHERE 1=0
Remeber that it will not copy the keys and indexes
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Educo Gent" <educo.gent@.skynet.be> wrote in message
news:ndHOd.8101$Ll6.561275@.phobos.telenet-ops.be...
> How can I copy fields (not records) from one table to the field structure
> of another table (in the same database on a sql server 2000)? So that I
> have not to re-type the name and properties of the fields and to be sure
> the name and properties of the fields are the same in both tables.
> Thanks,
> Hugo
>|||Hi Roji
The syntax is wrong
> SELECT * FROM SourceTable
> Into DestinationTable WHERE 1=0
SELECT * INTO Dest FROM Source WHERE 1=0
"Roji. P. Thomas" <thomasroji@.gmail.com> wrote in message
news:O0bvQS2DFHA.1292@.TK2MSFTNGP10.phx.gbl...
> SELECT * FROM SourceTable
> Into DestinationTable WHERE 1=0
> Remeber that it will not copy the keys and indexes
> --
> Roji. P. Thomas
> Net Asset Management
> https://www.netassetmanagement.com
>
> "Educo Gent" <educo.gent@.skynet.be> wrote in message
> news:ndHOd.8101$Ll6.561275@.phobos.telenet-ops.be...
structure
>|||You are right Uri. Thanks
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23QWD0W2DFHA.3504@.TK2MSFTNGP12.phx.gbl...
> Hi Roji
> The syntax is wrong
>
> SELECT * INTO Dest FROM Source WHERE 1=0
> "Roji. P. Thomas" <thomasroji@.gmail.com> wrote in message
> news:O0bvQS2DFHA.1292@.TK2MSFTNGP10.phx.gbl...
> structure
>

No comments:

Post a Comment