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 2005 Forums
 Transact-SQL (2005)
 table column comparision

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2012-03-14 : 21:17:57
Hi All,

I have 2 tables
1.transaction with duplicates
Name | division |cost_center_name|

2.costcenter table

Name| cost_center_name|

I need to compare the values for cost_center_name in the both the tables how do we do this.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-03-14 : 23:16:00
What do you mean by "compare"? Show us a data example to make your post clear.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2012-03-14 : 23:31:00
i need to compare the values for cost_center_name in both the tables.
If the values are same then don't do anything if not we will have update to table from other table.

for example: for each row value of table 1 for column "cost_center_name" needs to check with table 2 column "cost_center_name"

Thanks,
Gangadhara MS
SQL Developer and DBA
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-03-15 : 12:48:39
Which table will get updated if there is a difference?

Also, why isn't your database properly normalized?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -