以下查询在mssql中运行正常。 我尝试使用information_schema而不是sys。但是在mysql中没有运气。
SELECT c.NAME AS property_name,
t.NAME AS datatype
FROM sys.columns c
JOIN sys.objects o
ON o.object_id = c.object_id
JOIN sys.types t
ON t.user_type_id = c.user_type_id
JOIN sys.schemas s
ON o.schema_id = s.schema_id
WHERE s.NAME ='{0}'
AND o.NAME ='{1}
答案 0 :(得分:1)
你走了:
SELECT
COLUMN_NAME AS property_name,
DATA_TYPE AS datatype
FROM information_schema.columns
WHERE
TABLE_SCHEMA = {0} AND
TABLE_NAME = {1}
ORDER BY ORDINAL_POSITION