Insert data from one table into target table

mallinarc

New member
Local time
Today, 08:31
Joined
Jul 1, 2003
Messages
8
Hi

I was trying to write the following code in SQL window in Access 2000. It seems like i am doing stupid mistake some where (the help is not very helpful).

insert into BuildingNumberName (BuildingNumber, BuildingName) values (select Master Data.Building Number, Master Data.Building Name from Master Data);

the error reads as " Systax error in query expression .... select Master Data.Building Number"

Can anybodyhelp me.

i am doing this to populate the destination table with the data in source table (but not all data)

Thanks
 
So close, if you had looked in the help you wouldnt need to post.(its what i just did)

INSERT INTO target [(field1[, field2[, ...]])] [IN externaldatabase]
SELECT [source.]field1[, field2[, ...]
FROM tableexpression



So



insert into BuildingNumberName (BuildingNumber, BuildingName) select Master Data.Building Number, Master Data.Building Name from Master Data;



Enjoy







:cool:ShadeZ:cool:
 
Thank you ShadeZ

The code needs little modification. The one below works perfect.

INSERT INTO BuildingNumberName ( BuildingNumber, BuildingName )
SELECT [Master Data].[Building Number], [Master Data].[Building Name]
FROM [Master Data]

Thank you for your time.

Mallinarc
 
Sorry, i didnt notice you were using spaces in your field names. I prefer not to use spaces, they are just to much hassle.

anyway nice to c you sorted out.



:cool:ShadeZ:cool:
 

Users who are viewing this thread

Back
Top Bottom