Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 creating links during importing data

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-11-16 : 09:44:28
John writes "I have 3 tables:

Import_accomodation:
- several attributes.....
- continentname
- regionname

Continent:
- ContinentId (PK)
- ContinentName

Country:
- CountryId (PK)
- ContinentId (FK, can be null)
- CountryName

The import_accomodation table is a flat table from which I want to transfer data into the continent and country tables. Of course these are related. I don't know which query to use for this. To fill continent I use:
insert into continent select continentname from import_accomodation where continentname != '' and continentname not in (select name from continent)
But to fill country I don't know how to create a query to get the optional relation.
Thanks a lot."
   

- Advertisement -