Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving date and time and getting date
Message
From
26/02/2010 12:01:37
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/02/2010 09:17:44
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
01450712
Message ID:
01451265
Views:
29
>>Metin,
>>
>>In SQL Server you can not create an index using a function. Use a date range when looking for a date, e.g.
>>
>>select * from myTable where DateField >=@Today and DateField < @Tomorrow
>>
>
>Thank you all,
>I'll use Naomi's way. I use in first variable today 00:00 and second variable today 24:59:59 . I'm afraid of about performance in other ways. I'm not sure if sql server will use index with other ways...

OK. I think you meant >= @today and < @today + 1. I am not afraid about performance in other (and possibly better) ways:) In other ways of course it would use the index because it finds just the index it wants - I assume by other ways you mean creating computed column and indexin on it:)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform