Re: How ">=" Work on Varchar field?

From: Prabhat (not_a_mail_at_hotmail.com)
Date: 11/02/04


Date: Tue, 2 Nov 2004 22:29:59 +0530

Hi Tom,

Because my original Query was bit slow when used with order by. So I am
using that with Index hint, Now that is very fast.

Thanks
Prabhat

"Tom Moreau" <tom@dont.spam.me.cips.ca> wrote in message
news:#iStL0PwEHA.4048@TK2MSFTNGP15.phx.gbl...
> ORDER BY is used for sorting. Why don't you want to use it? Index hints
> are used only when your particular query is not performing properly and
this
> method is used only in exceptional cases. Using index hints for sorting
is
> like using a wrench to put out a fire.
>
> --
> Tom
>
> ---------------------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinnaclepublishing.com
>
>
> "Prabhat" <not_a_mail@hotmail.com> wrote in message
> news:%23flHHwPwEHA.2016@TK2MSFTNGP15.phx.gbl...
> Hi Tom,
>
> I don't want to use the Order by, SO I have used the Index Hint there in
the
> query.
> Thanks
> Prabhat
>
> "Tom Moreau" <tom@dont.spam.me.cips.ca> wrote in message
> news:u3mXVqPwEHA.3288@TK2MSFTNGP14.phx.gbl...
> > The where clause has absolutely nothing to do with sorting. Check out
> ORDER
> > BY in the BOL.
> >
> > --
> > Tom
> >
> > ---------------------------------------------------------------
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Columnist, SQL Server Professional
> > Toronto, ON Canada
> > www.pinnaclepublishing.com
> >
> >
> > "Prabhat" <not_a_mail@hotmail.com> wrote in message
> > news:uYrcXoPwEHA.1976@TK2MSFTNGP09.phx.gbl...
> > Hi All,
> >
> > Thanks for the discussion.
> >
> > Now I am clear that That is not the Sum(Ascii) but There is some thing
> that
> > uses the Ascii for all Characters in the Word to Compare. I have to know
> > that.
> >
> > Below is my Situation:-
> >
> > Table1
> > =====
> > DonorID Int (Identity) - Set to "Primary key"
> > LastName varchar(25)
> > FirstName varchar(25)
> > ...
> > ...
> > ...
> > There is a Compoud Index IND_DONOR_NAME - on LastNAme, FirstName.
(Because
> I
> > Want the output order by Lastname, FirstName
> >
> > When I Issue the SQL:-
> >
> > select donorid, firstname, lastname, state, zip, phonenum, country,
> > olddonorid, sourceid
> > from donor (index = ind_donor_name)
> > where lastname >= 'nath' and sourceid = 'flcc'
> >
> > I do get the Result, But the result is not Properly Ordered.
> >
> > Means: I have "nath" as Last Name in 7 rows (Which Includes all the rows
> > that returns). While I get 2 Rows as my 1st 2 rows of result set and
rest
> 5
> > rows I get at End of the result set (After Z). I Also Reindexed the
Table.
> > Still Did not help.
> >
> > If I Use Like 'nath%' instead of >= 'nath' I get the correct Order -
> Proper
> > use of the Index. So I am Confused and wanted to know what is that
causing
> > the >= to not order propwerly?
> >
> > Thanks
> > Prabhat
> >
> > "Prabhat" <not_a_mail@hotmail.com> wrote in message
> > news:#wLgPgOwEHA.3012@TK2MSFTNGP10.phx.gbl...
> > > Hi All,
> > >
> > > Suppose I will use
> > > Where col1 >= 'value1'
> > >
> > > and the col1 is a varchar - Indexed column, then how does the >= works
> on
> > > that Case?
> > >
> > > Does that take the sum of the ascii value of all characters of value1
> and
> > > find all rows with > value then the sum and display, or how?
> > >
> > > Thanks
> > > Prabhat
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: How ">=" Work on Varchar field?
    ... I think if a proper Index is used in the Execution plan then that will ... > index hint, I'd suggest using the Index Tuning Wizard. ... > Columnist, SQL Server Professional ... > Hi Tom, ...
    (microsoft.public.sqlserver.programming)
  • Re: How ">=" Work on Varchar field?
    ... index hint, I'd suggest using the Index Tuning Wizard. ... Columnist, SQL Server Professional ... "Tom Moreau" wrote in message ... > "Tom Moreau" wrote in message ...
    (microsoft.public.sqlserver.programming)
  • Re: query datetime range, how to optimize
    ... What happens when you take OFF the index hint ... I support the Professional Association of SQL Server and it's community of SQL Server professionals. ... Wherease the query on date only is much> faster. ...
    (microsoft.public.sqlserver.server)
  • Re: query not picking up index
    ... it's doing full scan on BATCH. ... Seems like Oracle is making an good decision. ... Try the query in Explain Plan both with and without the INDEX hint ...
    (comp.databases.oracle.server)
  • Forcing index usage...
    ... I'm in a situation where oracle spatial doesn't use a domain index even if I use the index hint. ... as long as the spatial operator is the only predicate in the where ... But as soon as I add more predicates or nest the query into another one, ...
    (comp.databases.oracle.server)