List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:November 22 2002 4:25pm
Subject:Re: Re: DATETIME Masking and Comparison
View as plain text  
sql,query

At 8:53 -0500 11/22/02, Nicholas Elliott wrote:
>So essentially, you want to put an index on part of the column, and not the
>whole column, right? As in, an index on just the date part, and not the time
>part. (Or both -- it seems like you want it to do both at the same time).
>Much like you can with a char column -- put a char on the first 2 letters,
>so that you can return all columns that have those first two letters the
>same.

Index prefixes may be applied only to string columns.  What you suggest
won't work for a DATETIME column.

>
>So... can you change the DATETIME column to a char[14] column, and then put
>an index on the first 8 characters (representing your date)?  That seems to
>be what you're looking for -- because then you could search for just the
>date (the first 8 characters) and it would be a direct ref to all the times
>under that date.
>
>Or am I completely off base here =]
>
>Nick Elliott

That would work, although of course then you lose the advantages of
storing values as DATETIMEs.
Thread
Re: Re: DATETIME Masking and ComparisonPaul DuBois22 Nov