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
 General SQL Server Forums
 New to SQL Server Programming
 Insert diffrent columns,Determine non unique fields

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-09-19 : 07:46:13
andre writes "I have two questions:

1.)How do i determine if fields are not unique??
2) How to update one table with values from another table when the row names are diffrent??

Thank you!!"

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-19 : 07:52:47
1)
SELECT Field FROM Table GROUP BY Field HAVING COUNT(*) > 1

2)
UPDATE a
SET a.Col1 = b.Col992312
FROM MyTable a
INNER JOIN MyOtherTable b ON b.ColABC = a.Col123


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -