3
使用SQL Server 2000有更簡單/更簡潔的方法嗎?SQL Server 2000:在記錄的1/3(或2/3)中的字段長度
每隔幾天我需要這樣做。
我先來看看我們有多少條記錄共有:
SELECT COUNT(*) FROM MyTable
然後我列出某一領域的所有長度:
SELECT LEN(MyText)
FROM MyTable
ORDER BY LEN(MyText) ASC
然後我需要向下滾動的1/3方式...並注意價值。 然後我需要向下滾動方式的2/3 ...並記下值。 然後最後是最後一個值。
我需要找出的x,y和z:
33% of the records have this field with a length under x bytes
66% of the records have this field with a length under y bytes
100% of the records have this field with a length under z bytes
你有沒有休息標識列?如果你這樣做(或者可以加一個),那麼得到總數併除以3。 – ScottE 2010-08-23 20:03:45