Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I get a record using sql using a secondary index

Posted on 2010-11-09
3
Medium Priority
?
283 Views
Last Modified: 2012-05-10
I have a sql table with a secondary index.  This secondary index is also unique but uses multiple fields.  Using variables to find the one record, should I still use a sql select statement or is there a better way?  I am using C# in visual studio 2008. Yes, I am a beginner.
0
Comment
Question by:StuBabyAight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
mkobrin earned 2000 total points
ID: 34099420
Your SQL select query normally makes use of the indexes that are available based on the fields in the select statement by default, however you can force the index to be used. EG:

SELECT column_list FROM table_name WITH (INDEX (index_name) [, ...])

0
 

Author Comment

by:StuBabyAight
ID: 34099431
Great, I figured it was the most effecient way, but I wanted to check I hadn't missed an area of C# that allows me to get a single record.  Thanks!
0
 

Author Closing Comment

by:StuBabyAight
ID: 34099435
Thanks for the quick reply
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question