Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 COALESCE function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-06 : 09:12:43
Maria writes "If I use this function.
Will it use the indexes.


If this customers table is large and we have indexes on
the 3 columns used.
Will the use of this function use the indexes
or will it be a full table scan.


SELECT Cus_Name,
Cus_City,
Cus_Country
FROM Customers
WHERE Cus_Name = COALESCE(@Cus_Name,Cus_Name) AND
Cus_City = COALESCE(@Cus_City,Cus_City) AND
Cus_Country = COALESCE(@Cus_Country,Cus_Country)"

dsdeming

479 Posts

Posted - 2002-05-06 : 09:24:35
I don't think it will use the indexes in this case ( at least it didn't in SQL 7 ), but you can check that by selecting Display Estimated Execution Plan from the Query Analyzer menu with the relevant code highlighted.

Go to Top of Page
   

- Advertisement -