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 |
|
JERICHO
Starting Member
18 Posts |
Posted - 2002-10-08 : 23:16:30
|
| hey, is there any way that i can control the index ordering.say now i am control the way my data is being sort by inserting this clustered indexcreate clustered index order on tbl_1 (custid desc)gook but with my table my values for custid is as followCustidaaron boy catdogothersif there anyway i can control the index and sort it in a way that others will always be the last ? |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-10-08 : 23:29:35
|
| It really doesn't matter if you store the rows in descending order, you can use a CASE expression in the ORDER BY clause to order them:SELECT * FROM tbl_1ORDER BY CASE CustID WHEN 'others' THEN 1 ELSE 0 END,CustIDRemember, if you want to SELECT rows in a particular order, you MUST use an ORDER BY clause. You WILL NOT get reliable sorting without it, no matter what you do with the indexing. |
 |
|
|
JERICHO
Starting Member
18 Posts |
Posted - 2002-10-08 : 23:43:59
|
| It is not really a select statement because i am using another tool to disply my information from the db so is there an alternative? |
 |
|
|
JERICHO
Starting Member
18 Posts |
Posted - 2002-10-08 : 23:44:33
|
| It is not really a select statement because i am using another tool to disply my information from the db so is there an alternative? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-10-09 : 09:01:55
|
| What tool are you using? The fact remains that SQL Server returns rows using a SELECT statement, regardless of how the interface is designed or implemented. If that tool doesn't allow you to specify a sort order, or supply customized SQL statements, you should use something else. |
 |
|
|
|
|
|