Solved

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

Posted on 2010-11-09
3
278 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
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
mkobrin earned 500 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

777 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