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)
 two tables, two columns, update

Author  Topic 

tighger
Starting Member

5 Posts

Posted - 2007-07-10 : 18:15:53
I have been hit with a snag. I have one table with parts in it and one column was forgotten from a spreadsheet that the table was originally created from. I need to get that column into the table but make sure obviously the columns match up. So far I have tried everything I can think of and no luck. I would just start over, but lots of data was updated changed in other columns before this problem was noticed. This is a sql server database. Any thoughts on how I might take on this task.

I have tried doing a relational thing with Access and then pasting in the results and just nothing is working.


Thank You

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-07-10 : 18:17:50
Is there a PK on the table that did not change from the spreadsheet vs the table?

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

tighger
Starting Member

5 Posts

Posted - 2007-07-10 : 18:39:05
There is a primary key in the table, but the value I need to match on has duplicates. This table has about 30,000 part numbers in it. Some are duplicate because some are made by different manufacturers. I need to take an excel spreadsheet that has these part numbers in and in essence import the data into the table so that when it finds a match in the spreadsheet to import a certain value from a column in the matching field.



Thank You
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-07-10 : 19:09:14
You can import the excel sheet into another table and join that new table with the existing table with what you think are reasonably similar columns. Perhaps theres no one perfect script that finds all data. You might have to do it in phases until there are no more records. You can create an additional column in the new table with probably a bit field and mark the row as processed if a match is found. This way you wouldnt be running in circles.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-07-11 : 01:32:12
Refer this to know the example
http://sqlteam.com/forums/topic.asp?TOPIC_ID=49926

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -