how to fetch column using column index in sql server.


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.

Please remember to click “Mark as Answer” on the post that helps you

Jasim Akhtar
New Delhi ( INDIA )
9/2/2008 10:20:32 AM 29906 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 46

Yes there is.
It's called dynamic SQL and it's a complicated process.

Please click "Mark as Answer" if my reply solved your problem.

9/2/2008 11:37:30 AM

Similar Artilces:

Using @column = [column] SQL Server 2000
Should the following select statement return ALL the records including the records where [district] is null?  Currently it is only returning non null records.  I tried it with a default value and without with the same results. SelectCommand="SELECT [ID], [last], [first], [district], [TA] FROM [regd] Where ([district] Like case when @district is null then [district] else @district end)" <SelectParameters ><asp:ControlParameter ControlID="Last_textbox" Name="district" defaultvalue="%" PropertyName="Text" Type="Str...

Using Linq to SQL to insert into an SQL Server XML column
I'm getting an error on this line: ' auditData.PCAuditDataXML = Xdoc.Element("Model") 'Can anyone see where I'm going wrong here?    Private Sub insertDataIntoAuditDataTable(ByVal userName As String, ByVal computerName As String, ByVal Xdoc As XDocument)        Dim ADDC As AuditDataDataClassesDataContext = New AuditDataDataClassesDataContext        Try            Dim auditData As New AuditData_ad     ...

Problem in using sqlbulkcopy to insert data from datatable(no identity column) into sql server table having identity column
Hi, I am having problem in bulk update of a sql server table haning identity column from a datatable( has no identity column) using sqlbulkcopy. I tried several approaches, but it does not show any error nor is the table getting updated. But the identity value seems to getting increased every time. thanks. varun Hmmmm...that means it is inserting something...I wonder if your datatable has data in it. Can you check that?Thanks,MaxLet Me Google That For You! The first thing i did was checked it. The datatable is getting populated fine. What could possibly be wrong si...

Need query to get distinct column name and details based on that column using sql server 2000
hi, iam having three tables as shown below table 1                                                      table 2                                     &...

This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers
When I connect SQL Server 2005 to a remote database i get the error: "This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers". Can I confirm it is because: the remote db is of SQL Server 2008? There is a soln mentioned in Did anybody try this (installing 2008 express: I am just checking again, whether it will disturb my existing SQL Server installation, in any means...? Though it is mentioned that it will g...

what is the Included no-index-key index column in SQL Server 2005?
is it the same performance and functions between index-key index column and Included no-index-key index column when queried by WHERE conditions and ORDER BY conditions?Parco LeeOwner + Webmaster + System Engineer + Professional ProgrammerSoftDweller Lab (a software laboratory)http://www.softdweller.comA professional laboratory for new technology softwares developing by .NET. Index column include is a fancy composite key, one of the key features of SQL Server 2005, it should be faster with the WHERE Clause but I cannot say about the ORDER BY because ANSI SQL puri...

Converting a gridView using an Sql Datasource to a gridview who is not using an SQL DataSource
How can i rewrite this page so that i doesnt make use of an SqlDataSource?  <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginHistory.ascx.cs" Inherits="Private_UserControls_WebUserControl" %> <html> <head> <%--<link rel="stylesheet" href="BaldwinPortal.css" mce_href="BaldwinPortal.css" type="text/css" />--%> <title>Login History</title> </head> <body style="margin:0 0 0 0;padding:0 0 0 0"> ...

Fetch Few characters from Column Sql server
Hi All, I want a function in sql which has similar functionality like Substring... Here is my request : I have data in col... LastName, FirstName ABCD-EFG/1234 But I want to display only LastName, FirstName.... rest of charcters should be removed.... plz helpRegards,MS Developer Well, Transact SQL has a SUBSTRING function.C# <---> VB.Net Translator  Thanks I do I get only LastName, FirstName from that string.....Regards,MS Developer If you can change your database it would be best to store LN & FN as seperate fields.  The problem is ...

Attach SQL DB to SQL Server 2005 using VB.Net
Is there any way to attach a SQL DB to SQL Server 2005 using VB.Net?  If so can you also set security? Can you rephrase your question? Attach SQL DB from which version of SQL server ? Look up books online for sp_attachdb and sp_detachdb.***********************Dinakar NethiLife is short. Enjoy it.*********************** I have a DB that was created in SQL Server 2005.  I have a website that displays data from systems all over the world.  Each system sends it's data to it's own DB.  The customer can then go to a website and see the data at real time.  What ...

Reuse derived columns in same SQL Select statement under SQL Server 2005
Hello, Our agency is in the process of migrating our Sybase Adaptive Server Anywhere 7.0 databases to Microsoft SQL Server 2005. We are currently using PowerBuilder 10.5. We have several datawindows that reuse SQL computed fields (derived columns) in the same SQL Select statement. Here is an example: select institution_code, incident_number, sequence, final_review_date, ts_status_code, idoc_number, (CASE WHEN coalesce(s.recommended_verbal,'N') <> coalesce(s.final_verbal,'N') then 1 else 0 end) as c_verbal, (CASE WHEN coalesce(s.recomme...

creating ssis packagte for sql server to sql serer using
Hi friendsdoes any one has code or urls which can help me to create the ssis pacakage which will transfer data from sql server to sql server databaseswith some manipulationsthanks so much Lad LaxmikantPune You are probably in the wrong forum.  This forum is for questions relating to ASP.NET Dynamic Data. thanks,David...

Creating a SQL Server linked server to Interbase using 64 bit SQL Server
Hi, I am trying to use the data direct odbc driver for interbase to create a linked server in SQL Server 2008 R2 64bit however, SQL Server reports an "Arcitechure Mismatch" between the System DSN and SQL Server. This did work under 32 bit SQL Server. Is there a 64bit specific odbc driver for interbase? I have tried using the IBProvider trial as well but this fails to work in SQL Server as well. Our Interbase client(s) and server are all 64 bit installations. Thank you Julian Dawson wrote: > Is there a 64bit specific odbc driver for interbase? I think Easy...

SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)?  Thanks, Azam HighOnCodingWanna get high! Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...

How to specify an include column for an index in SQL Server 2005
Hi, How can I specify an include column for a non-clustered index in SQL Server 2005. I am using PowerDesigner Thanks, Werner Support for the Include physical option was add in PD 12.1.0. You will need to upgrade to 12.1.0 or 12.5.0. Anthony <Werner Geuens> wrote in message > Hi, > > How can I specify an include column for a non-clustered > index in SQL Server 2005. > I am using PowerDesigner > > Thanks, > > Werner ...

Web resources about - how to fetch column using column index in sql server. -

Politics, Political News - The Capitol Column
Covering the politics of science, technology, business, entertainment, Capitol Hill, and health.

Trajan's Column - Wikipedia, the free encyclopedia
Trajan's Column ( Italian : Colonna Traiana ) is a Roman triumphal column in Rome , Italy , that commemorates Roman emperor Trajan 's victory ...

Column 8: 'Don't order anything'
A word of warning about the true meaning of Australia Post's 'Hold Mail' service from Brian Jeffrey, of Cook, ACT.

Column 8
&quot;My favourite hotel sign was in India,&quot; writes Michael Robinson, of Cammeray (Column 8, last week). &quot;It read 'The water in this ...

Paris attacks: column in IS magazine warns of 9/11-scale attack to come
Under the byline of a hostage British journalist, Islamic State warns that it may attempt a terrorist attack even bigger than 9/11.

Column 8: More weird 'hotel signage'
&quot;I have more weird 'hotel signage',&quot; offers George Watson, of Grafton (Column 8, Thursday). &quot;The following was posted on the wall ...

The 10 Best Online Columns Of All Time . . .
Former Biglaw partner and inhouse columnist Mark Herrmann identifies the ten best online columns of all time.

Should the Washington Post’s Ties to Reagan Library Be Disclosed in Columns Attacking Bill O’Reilly?
Much has been discussed regarding the recent spat between Washington Post columnist and Fox News contributor George Will and Fox News host and ...

Check out the highest-rated comment on this WaPo column, "The American Dream? I thought so, until I had ...
... maternity leave to be with a child you chose to have while still eating out, watching HBO, and buying a new car." The author of the column is ...

Tim O'Sullivan column: Giving thanks to our father figures on this holiday
Concord Monitor Tim O' Sullivan column: Giving thanks to our father figures on this holiday Concord Monitor That man would be Celtics basketball ...

Resources last updated: 12/6/2015 4:10:08 AM