Using Unique keys 
Author Message
 Using Unique keys
Hi,
  I am using CDatabase and CRecord set from c++ and MFC. How do I select
which unique key to use for the search. For example, if I had a database
with 3 unique keys, and doing a search for 2 fields, each with a unique key.
At what stage are the keys used? Do I select which keys to use, or does the
SQL server does it all itself?

neil



Sat, 29 May 2004 21:33:05 GMT
 Using Unique keys

If there are unique constraints defined on the columns, then the columns are
indexed in SQL Server and depending on your SQL statement (which columns are
retrieved, WHERE clause, ORDER BY, JOIN, etc.), the query engine in SQL
Server will determine which index to use on its own.  To see what the query
engine is doing, you could trace your application using Profiler, copy the
statements from Profiler and run them in Query Analyzer with the Show
Execution Plan option from the Query menu.

--
Bob
Microsoft Consulting Services
------
This posting is provided AS IS with no warranties, and confers no rights.



Sat, 29 May 2004 22:51:01 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. MDX query using unique key

2. UNIQUE CONSTRAINTS & UNIQUE INDEXES/PRIMARY KEYS

3. UNIQUE CONSTRAINTS & UNIQUE INDEXES/PRIMARY KEYS

4. Creating a unique key made up of a pseudo unique id and a counter

5. Make field unique without using primary key?

6. Can't drop an index - It is being used for UNIQUE KEY constraint enforcement

7. Wondering about using datetime as unique key...

8. Primary Key Vs. Not NULL Unique Key

9. Primary Key/Unique Key?

10. Primary Key vs Unique Key


 
Powered by phpBB® Forum Software