Zolf
asked on
Compare strings in 2 table and asisgn its primary key to the second table
Hello there,
I have two tables which has name common in both the tables. now I want to compare the names and assign the pk of table1 to table2 as FK. one thing to mention is that the name cole is a Nvarchar i.e. it is UTF-8 character.
by the way can I do this using SSIS
cheers
ZOlf
I have two tables which has name common in both the tables. now I want to compare the names and assign the pk of table1 to table2 as FK. one thing to mention is that the name cole is a Nvarchar i.e. it is UTF-8 character.
by the way can I do this using SSIS
cheers
ZOlf
Yes, you can easily do this with SQL. In SSIS you will have to open the Query Analiser and construct and run a few SQL queries. Now, it would be great if you have specified the table names and the column names. That way we could write you the queries you can execute directly against your tables. Can you post this information?
ASKER
I am trying to get the id from province table into the country table
CREATE TABLE
country
(
id BIGINT NOT NULL IDENTITY,
Province NVARCHAR(255) COLLATE Latin1_General_CI_AS,
County NVARCHAR(255) COLLATE Latin1_General_CI_AS,
District NVARCHAR(255) COLLATE Latin1_General_CI_AS,
City NVARCHAR(255) COLLATE Latin1_General_CI_AS
);
CREATE TABLE
province
(
id INT NOT NULL IDENTITY,
Province NVARCHAR(255) COLLATE Latin1_General_CI_AS,
Capital NVARCHAR(255) COLLATE Latin1_General_CI_AS,
ProvinceCode INT,
PRIMARY KEY (id)
);
ASKER
by the way I am trying to using SSIS using Data Flow Task and Lookup,but it is not working. anyway if we can get it with sql fine with me.just bear in mind my data in UTF-8 character not english
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
perfect....cheers mate
ASKER
can you please help me to split the district and city too,since you know my initial problem.