Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to fetch data using column index

Author  Topic 

rammohan
Posting Yak Master

212 Posts

Posted - 2008-09-02 : 06:48:52
Hi,

I have several columns in my table, but I want to fetch data using column index instead of column name in select command.

is there any way to do this.

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-02 : 07:01:38
Yes there is.
It's called dynamic SQL and it's a complicated process.
See http://www.sommarskog.se/dynamic_sql.html

The real question is "WHY?".



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-02 : 08:25:32
Or do it in your front application. Bring it to recordset and then use position to retrive what you want.
Go to Top of Page
   

- Advertisement -