We are using upper case letters in the customer account numbers. But sometimes there are some human errors inputting the lower case in the account numbers. How can we identify them using T-SQL? It is quite simple. Just use the COLLATE Latin1_General_CS_AI criteria for the string comparison:
<span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #0000ff">SELECT</span> AccountNumber <span style="color: #0000ff">FROM</span> Customer
<span style="color: #606060" id="lnum2"> 2:</span> <span style="color: #0000ff">WHERE</span> AccountNumber != <span style="color: #0000ff">UPPER</span>(AccountNumber) <span style="color: #0000ff">COLLATE</span> Latin1_General_CS_AI