Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to optimize this SQL code of datetime
Message
From
09/12/2005 05:33:14
 
 
To
09/12/2005 05:13:50
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01076504
Message ID:
01076509
Views:
16
>Hi,
>
>Anyone know of a better way to optimize
>my query below so that the optimizer will
>do a clustered index seek insteads of the
>clustered index scan. Those commented out
>code are those code that I test with.
>
>In addition, is there any function to
>convert datetime to numeric value
>and vice versa
>
look datediff() and dateadd()

>-- index on PD_INDEX pd_security(product_id)
>select * from pd_security
>where
>--cast(exp_dt as datetime) = '9999-12-31'
>--convert(char(10),exp_dt,21) = '9999-12-31'
>exp_dt = cast('9999-12-31' as datetime)
index pd_security (exp_dt)

select * from pd_security
where exp_dt = '99991231'
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform