By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 1,592 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

How do you create a new table with different field names

P: n/a
Hi all

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?

Please give an example.

What is the best way to approach?
Thanks

Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Keep it simple ! Use a make table query. You can change the field name by
putting a new name in front of the existing one at the top of the query grid
with a colon between. Like this - Newname:existingname
HTH
David B
Hexham UK

Jim's wife <ta*****@mindspring.com> wrote in message
news:PV**********************@news4.srv.hcvlny.cv. net...
Hi all

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?

Please give an example.

What is the best way to approach?
Thanks


Nov 12 '05 #2

P: n/a
The simplest way is, in the database window, highlight the table, copy and
paste it -- you'll be asked for a new name. Then open the new table in
design view and make the changes.

Larry Linson
Microsoft Access MVP

"Jim's wife" <ta*****@mindspring.com> wrote in message
news:PV**********************@news4.srv.hcvlny.cv. net...
Hi all

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?
Please give an example.

What is the best way to approach?
Thanks

Nov 12 '05 #3

P: n/a
Hi all

Thanks for your help.
But I need to do this in code. Thanks!!

I look forward to your replies


"Jim's wife" <ta*****@mindspring.com> wrote in message
news:PV**********************@news4.srv.hcvlny.cv. net...
Hi all

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?
Please give an example.

What is the best way to approach?
Thanks

Nov 12 '05 #4

P: n/a
This works great until I have a field with spaces.
I get an error when there are spaces. I can't even do [New Fieldname]

is there a special character for a space I can try?

Thanks

"David B" <da***@marleycotenospam.fsnet.co.uk> wrote in message
news:bv**********@newsg3.svr.pol.co.uk...
Keep it simple ! Use a make table query. You can change the field name by putting a new name in front of the existing one at the top of the query grid with a colon between. Like this - Newname:existingname
HTH
David B
Hexham UK

Jim's wife <ta*****@mindspring.com> wrote in message
news:PV**********************@news4.srv.hcvlny.cv. net...
Hi all

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?
Please give an example.

What is the best way to approach?
Thanks

Nov 12 '05 #5

P: n/a

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!
Nov 12 '05 #6

P: n/a
thanks all

the sql strings in code worked using [renamed field]
for some reason it doesnt in the query designer

"Jim's wife" <ta*****@mindspring.com> wrote in message
news:PV**********************@news4.srv.hcvlny.cv. net...
Hi all

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?
Please give an example.

What is the best way to approach?
Thanks

Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.