how to fast sql query
hi friend
can anybody tell me how to fast my sql query.I m insert some field from another table that has around 5 lak data,I just insert 100 row according to date.I have use clustred index on date but speed is quite slow due to where clause in which I have use a description field and their are lots of and i.e
" (detail like '%car%' and '%truck%' ) OR (detail like '%shirt%' and '%pant%' ) "
Is their any solution?
Jan MontanoPosted Jul 24, 2007, 5:01 AM
Why did you make a clustered-index for your date? Is it somehow a primary key in your table? Declaring a non-clustered index for details will definitely help because you're where cause includes the detail. You could also consider using Dynamic SQL to use a stored procedure though there are pros and cons that comes with it -> Dynamic SQL
Cheers,
Jan
kavitaPosted Jul 20, 2007, 2:31 AM
Rolando PunoPosted Jul 19, 2007, 10:18 PM
Jan MontanoPosted Jul 19, 2007, 8:38 PM
Please post the structure of your whole query. Is the detail column indexed? If not, making it indexed will make it faster. Could you also post the CREATE TABLE and CREATE INDEX statements for the table? Thanks.
Regards,
Jan