Użytkownik "Jim's wife" <ta*****@mindspring.com> napisał w wiadomo¶ci
news:PVOQb.18586
I need to create a new table based on a source table.
The new table is almost the same as the source table in that just some
field names must change, and a few new fields added or dropped?
I was thinking of renaming the fields somehow, then using sql to add
/drop?
Hi!
Executing this:
SELECT * INTO YourNewTable FROM YourSourceTable
all data from the YourSourceTable will be copied to YourNewTable.
When you set condition WHERE to eg. 1=2, then you obtain new, empty table
named YourNewTable.
SELECT YourSourceTable.OldFieldName AS NewFieldName YourNewTable FROM
YourSourceTable;
Using this syntax you can set a new name to a specified field.
You may also change numbers of fields by creating new ones or droping
existing.
ALTER TABLE YourNewTable ADD COLUMN NewColumn DATE;
ALTER TABLE YourNewTable DROP COLUMN ColumnYouDontWant;
Leon!