Sandy bhardwaj Sandy bhardwaj - 2 years ago 92
SQL Question

how can I get index number of any column in SQl database?

Select ROW_NUMBER() OVER(Password) From Student

Answer Source

Most, but not all (I think Oracle is one which doesn't) database systems implemented the INFORMATION_SCHEMA which you can query to get information about database objects. In order to get the ordinal position of a column in a table, you can use:

SELECT      C.ORDINAL_POSITION
FROM        INFORMATION_SCHEMA.COLUMNS AS C
WHERE       C.TABLE_NAME = 'Table'
        AND C.COLUMN_NAME = 'Password'

I can't help wonder why you need this information though...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download