Hi ,
Are there any INDEXES in SQL such that they could be scanned from left
to right or right to left(like that in DB2).
Thanks,
Dutt.The leaf level of any index in SQL Server is a doubly linked list, so it can be scanned in either
direction. You can specify whether an index is ASC (default) or SESC, but this is only necessary in
situation like:
ORDER BY a ASC, B DESC
(Assuming you want to have an index supporting that ORDER BY...)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1171015544.016561.150790@.h3g2000cwc.googlegroups.com...
> Hi ,
> Are there any INDEXES in SQL such that they could be scanned from left
> to right or right to left(like that in DB2).
> Thanks,
> Dutt.
>|||Dutt
No , I'm afraid NO. What is the benefit to scan indexes from left to right?
What is your concern?
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1171015544.016561.150790@.h3g2000cwc.googlegroups.com...
> Hi ,
> Are there any INDEXES in SQL such that they could be scanned from left
> to right or right to left(like that in DB2).
> Thanks,
> Dutt.
>|||Hi Uri,
I'm converting some DB2 objects into SQL.
Tell me how to proceed with the following stmts.
CREATE INDEX "DB2ADMIN"."IDX604031811150000" ON "GPT
"."PRODUCT_FEATURE"
("FEATURE_CODE" ASC,
"END_DATE" ASC,
"START_DATE" ASC,
"PRODUCT_TIER_LEVEL" ASC,
"PRODUCT_CODE" ASC) ALLOW REVERSE SCANS;
Thanks,
Dutt.|||See my earlier post. All indexes in SQL Server can be scanned in both directions. No need for such a
"ALLOW REVERSE SCANS" option in SQL Server.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1171017130.483643.192230@.s48g2000cws.googlegroups.com...
> Hi Uri,
> I'm converting some DB2 objects into SQL.
> Tell me how to proceed with the following stmts.
>
> CREATE INDEX "DB2ADMIN"."IDX604031811150000" ON "GPT
> "."PRODUCT_FEATURE"
> ("FEATURE_CODE" ASC,
> "END_DATE" ASC,
> "START_DATE" ASC,
> "PRODUCT_TIER_LEVEL" ASC,
> "PRODUCT_CODE" ASC) ALLOW REVERSE SCANS;
> Thanks,
> Dutt.
>
>|||Dutt
CREATE TABLE t1 (a int, b int)
GO
CREATE UNIQUE CLUSTERED INDEX Idx1 ON t1(a ASC,b DESC)
GO
Modify a,b columns to your and specify SORT
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1171017130.483643.192230@.s48g2000cws.googlegroups.com...
> Hi Uri,
> I'm converting some DB2 objects into SQL.
> Tell me how to proceed with the following stmts.
>
> CREATE INDEX "DB2ADMIN"."IDX604031811150000" ON "GPT
> "."PRODUCT_FEATURE"
> ("FEATURE_CODE" ASC,
> "END_DATE" ASC,
> "START_DATE" ASC,
> "PRODUCT_TIER_LEVEL" ASC,
> "PRODUCT_CODE" ASC) ALLOW REVERSE SCANS;
> Thanks,
> Dutt.
>
>|||Tibor,
In ur previous post I mistook that u r more concerned abt the order of
a single fielded index.
OK,I got u now.
Thanks,
Dutt.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment