Solved

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

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Database Mail Profiles 1 52
sql server major issue  need help 2 83
Classic ASP - Display returned sql output parameter 9 57
Health check of winows and webservces 5 52
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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