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 |
jackandjill
Starting Member
1 Post |
Posted - 2014-10-05 : 00:37:31
|
How to write a query to determine that if a columns values are unique?This is just to determine. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-10-05 : 04:43:20
|
SELECT CASE WHEN min(Col1) < max(col1) then 'Different values' else 'All same value' endFROM dbo.Table1 Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
sunder.bugatha
Yak Posting Veteran
66 Posts |
Posted - 2014-10-08 : 05:51:37
|
If the column dont have dupes then that means it has unique values right..check for the dupesHema Sunder |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2014-10-08 : 06:48:03
|
If values are not unique, below query should return some result:select colfrom tablegroup by colhaving count(*)>1 Harsh Athalyehttp://in.linkedin.com/in/harshathalye/ |
|
|
|
|
|