如何知道 MS-SQL 中表中的列位置。
例如:如果一个表由 3 列组成,即column1、column2 和column3。
我应该编写一个查询,以便我可以获得 column3 的位置 3
最佳答案
您将从 information_schema 中获得所有这些。
select ordinal_position from information_schema.columns
where schema_name = 'databasename'
and table_name = 'tablename'
and column_name = 'column name'
关于sql - 表中列的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18953788/