You do not want to use 'LIKE '%". That causes the server to have to =
needlessly read each and every value.Also, you SHOULD list each column =
you want to retreive. Using SELECT * may cause you undesired problems in =
the future.
Here are a couple of choices:
1. NO where clause
SELECT=20
Column1
, Column2
, Column3
, etc
FROM MyTable
2. Where clause with the option to search for a value or get all rows if =
there is no value.
SELECT=20
Column1
, Column2
, Column3
, etc
FROM MyTable
WHERE SearchColumn =3D coalesce( @MySearchField, SearchColumn)
In the second example, you can pass in a search parameter =
@MySearchField, and if it is not NULL, it will be used to retreive =
matching data. If it is NULL, then all rows will be returned (subject to =
other search criteria, of course.)
--=20
Arnie Rowland, YACE*=20
"To be successful, your heart must accompany your knowledge."
*Yet Another Certification Exam
[quoted text, click to view] "Nishant Giri" <NishantGiri@discussions.microsoft.com> wrote in message =
news:57AABBF6-3FCC-405E-BF99-1FD131EF2A81@microsoft.com...
> Hi i am using sql 2000 . i am searching all the records into the =
database,=20
> for this i have used the 'Like %' in my query ..For Example
> Select * from table1
> WHERE Col1 Like '%'
>=20
> But the response time of this query is very high . How can i reducde =
the=20
> responsetime of the query , Is there any way to avoid this 'Like %' =
Operator=20
> so that i can search all the records and also reduce the response time =
..