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.
| Author |
Topic |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2010-03-22 : 12:37:01
|
| How could we determine programmatically what column is the unique ID for a view when no indexes exist for the view... |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2010-03-22 : 13:19:57
|
| It'll take a bit of work with multiple queries:IF NOT EXISTS (SELECT Column1, COUNT(*)FROM YourViewGROUP BY Column1HAVING COUNT(*) > 1)PRINT 'Unique'IF NOT EXISTS (SELECT Column1, Column2, COUNT(*)FROM YourViewGROUP BY Column1, Column2HAVING COUNT(*) > 1)PRINT 'Unique'...You'll need to do every combination of the columns, and even then you don't know if new data coming in will violate what you found. It's better to ask the people who know the data.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
|
|
|