Solved

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

Posted on 2010-11-09
3
282 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 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
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!
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

617 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