-
Import of data
Hi!I am using SQL Server 7.0.My query goes as follows
There are two tables Table1 and Table2 both of which have a column companykey
which have PK and FK relationship
I have imported data from a *.CSV file into Table2
Table2 has many to one relationship with Table1 in the sense for each company in Table1 there can be more than 1 employees in Table2
Now I want to insert only the value of column CompanyKey from Table2 to Table1 and also some other columns values like employeekey from Table2 to regiskey column in Table1.
Now how do I do this???
I need this very urgently...
-
insert question
Hi,
If you have defined a pk-fk relationship between the 2 tables based on companykey then it would be impossible for you to have values in the companykey column of table2 that don't have corresponding values in the companykey column of table1
That said here is how you would perform an insert like you describe below. Although the exact syntax will vary depending on the number of columns in table1:
insert table1 (companykey,regiskey)
select companykey, employeekey
from table2
hth,
andrew
------------
Prashant at 10/28/99 1:23:13 PM
Hi!I am using SQL Server 7.0.My query goes as follows
There are two tables Table1 and Table2 both of which have a column companykey
which have PK and FK relationship
I have imported data from a *.CSV file into Table2
Table2 has many to one relationship with Table1 in the sense for each company in Table1 there can be more than 1 employees in Table2
Now I want to insert only the value of column CompanyKey from Table2 to Table1 and also some other columns values like employeekey from Table2 to regiskey column in Table1.
Now how do I do this???
I need this very urgently...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|