문제

I inherited a table with about 40 columns and about 1400 rows. Unfortunately, the original designers didn't include an identifiable PK in the table so I'm assuming they used a natural key with a combination of 4 or 5 columns. However what those columns are are unknown.

Is there any easy way to determine this or do I need to sit down and start trying to reduce it via select statements?

도움이 되었습니까?

해결책

I ended up taking the approach of excel and filters and narrowing down items until I was left with one entry. After that I then took the approach of making sure those fields would always bring back a unique row.

To do that I went back to the DB and counted the distinct rows when just selecting those fields.

It took a bit of guess and check but it ended out working well.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top