Davebhoy (7/4/2013)
Hi thereI'm a novice a at SQL so hopefully this is an easy answer for someone.
I have a basic view which queries two tables in separate databases with one join on 'client' which also contains a WHERE clause using 'client'.
When I use a parameter for this column called @client (=@client) the results return almost instantly but when I use the same parameter as a text value (='XX'). It takes 20 seconds to return he same results!
Any help is appreciated.
Dave.
What is the datatype of the column in the underlying table that you're trying to compare to and what is the datatype of @Client? It might simply be a datatype mismatch causing a table scan instead of an index seek. Can't tell for sure because I don't have the schema for your tables, nor the code for your view, nor any information for what @Client actually is.
--Jeff Moden
Change is inevitable... Change for the better is not.