473,424 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,424 software developers and data experts.

How to select index column?

Hello

I want to select all those column from a table on which i have create index.


how to do it i am new with sql server.

thank u in advance.
Jul 10 '10 #1
2 3458
Why, don't you know the name of the columns? Where would you like to pass these names?
Jul 10 '10 #2
Jerry Winston
145 Expert 100+
All the information about the objects you create like tables, indexes, and columns can be accessed through metadata views. I dont know if you're planning to get SQL certified but even if you're not interested in becoming a db guru, it's worth learning your system views when working with MS SQL server. Here's a solution for you:
Expand|Select|Wrap|Line Numbers
  1. SELECT s.name as [Schema],t.name as [Table],c.name [Column],i.name as [Index] FROM sys.index_columns ic
  2. INNER JOIN
  3. sys.tables t
  4. on
  5. t.object_id=ic.object_id
  6. INNER JOIN
  7. sys.columns c
  8. ON
  9. c.column_id = ic.column_id
  10. AND
  11. c.object_id=t.object_id
  12. INNER JOIN
  13. sys.schemas s
  14. ON
  15. t.schema_id=s.schema_id
  16. INNER JOIN
  17. sys.indexes i
  18. on
  19. i.index_id=ic.index_id
  20. AND
  21. i.object_id=t.object_id
  22. where t.type='U'
  23.  
  24.  
Jul 11 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ganthan L via .NET 247 | last post by:
Hi..I dont know whether it's asked before..i've been trying for a while..but coluldn't find it... How do I resize/change the width datagrid's 0th column(the index column). Thanx in advance....
7
by: mghale | last post by:
Hi, This is probably a really dumb question but I have a table containing a varchar 4000 column. The app team is asking me to index this column to improve performance. I know this can't be...
6
by: Paul Sullivan | last post by:
Hi folks. I was hoping that someone can help me out here. I am adding items to a listbox from a database. So far, I've had no problems. However, when I try to use the SetSelected method and...
7
by: Aaron Lawrence | last post by:
Hello all. Is there a simpler way to write something like this: select column_a from table where column_b = ( select max( column_b ) from table ) ie. find the row where column_b is at it's...
0
by: Heini Nolsøe | last post by:
I have a database containing alot of procedures with this kind of coding logic: BigTable column1 varchar2(40); Procedure SomeProcedure (in_parameter varchar2) SELECT column1 FROM BigTable
0
by: MathewJose | last post by:
I have a datagrid with selected cells.I need to get the row,column index of 1st selected cell..How to get it? tried current Row.Index,Current.Column.Index..but it gives last selected cell's row...
1
by: anjanareddy | last post by:
Hai, i am unable to inserting duplicate data into UNIQUE index column, Is there any other process, to insert duplicate data into UNIQUE index column? plz let me know.. Thanks & Regards...
3
bartonc
by: bartonc | last post by:
Is it possible to select a column of type INTEGER PRIMARY KEY without knowing its name? This also happens to be column zero in all my tables. I've played with lots of different syntaxes, to no avail....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.