SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'myTable' AND ORDINAL_POSITION = '3'
This statement returns the third column of your table
You would need to write a transact SQL statement like
DECLARE @columnname nvarchar(100), @sql nvarchar(500)
SELECT @columnname = ORDINAL_POSITION FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'myTable' AND ORDINAL_POSITION = '3'
SET @sql = 'SELECT ' + @columnname + ' FROM mytable'
EXEC @sql
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…