且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从MS SQL数据表中检索列默认值

更新时间:2023-02-23 10:41:28

默认值仅在插入行时确定。

Default value is determined at the time of row insertion only.

作为替代方案,您可以利用 Information_schema

As an alternative, you can utilize Information_schema

SELECT TABLE_NAME, COLUMN_NAME, COLUMN_DEFAULT
FROM AdventureWorks2012.INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Person';