Getting Started with Adobe After Effects - Part 6: Motion Blur

Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Column name Vs Ordinal number

Jan 25 2011 1:55AM by Madhivanan   

Sometimes developers use ordinal number of the column instead of actual column name in the SELECT statement.

For example, consider the following statement

SELECT emp_id, first_name,dob, address from employees

When a front end application executes this statement it receives a resultset from the server with the exact column names given in the SELECT statement. Front end application can access the column names using the actual column name or the ordinal position in the SELECT statement

Consider the following code in a VB Application

Dim con as new ADODB.Connection
Dim rs as new ADODB.Recordset
con.connectionstring="connection string"
set rs=con.execute("SELECT emp_id, first_name,dob, address from employees")

We can now access the column name as

msgbox rs("emp_id")
msgbox rs("dob")


msgbox rs(1)
msgbox rs(3)

Now see what happens when column orders are chaged in the SELECT statement

set rs=con.execute("SELECT address, dob, first_name,emp_id from employees")
msgbox rs("emp_id")
msgbox rs("dob")

will give the correct results whereas

msgbox rs(1)
msgbox rs(3)

will give wrong result for emp_id and dob becuase now 1 refers to address and 3 refers to first_name. So it is always a best practice to use actual column names instead of ordinal position

Tags: t-sql, sql_server, sqlserver, tsql, BRH, #TSQL, #SQLServer, ordinal position,

2 · 40% · 13039


Your Comment

Sign Up or Login to post a comment.

"Column name Vs Ordinal number" rated 5 out of 5 by 1 readers
Column name Vs Ordinal number , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]