SQL Server 表创建日期查询
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1171019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQL Server table creation date query
提问by Galwegian
How can I get the table creation date of a MS SQL table using a SQL query?
I could not see any table physically but I can query that particular table.
如何使用 SQL 查询获取 MS SQL 表的表创建日期?
我在物理上看不到任何表,但我可以查询该特定表。
回答by Galwegian
For 2005 up, you can use
对于 2005 年起,您可以使用
SELECT
[name]
,create_date
,modify_date
FROM
sys.tables
I think for 2000, you need to have enabled auditing.
我认为对于 2000 年,您需要启用审计。
回答by adrianbanks
For SQL Server 2005 upwards:
对于 SQL Server 2005 以上:
SELECT [name] AS [TableName], [create_date] AS [CreatedDate] FROM sys.tables
For SQL Server 2000 upwards:
对于 SQL Server 2000 以上:
SELECT so.[name] AS [TableName], so.[crdate] AS [CreatedDate]
FROM INFORMATION_SCHEMA.TABLES AS it, sysobjects AS so
WHERE it.[TABLE_NAME] = so.[name]
回答by AdaTheDev
SELECT create_date
FROM sys.tables
WHERE name='YourTableName'
回答by jadki
In case you also want Schema:
如果您还需要架构:
SELECT CONCAT(ic.TABLE_SCHEMA, '.', st.name) as TableName
,st.create_date
,st.modify_date
FROM sys.tables st
JOIN INFORMATION_SCHEMA.COLUMNS ic ON ic.TABLE_NAME = st.name
GROUP BY ic.TABLE_SCHEMA, st.name, st.create_date, st.modify_date
ORDER BY st.create_date
回答by Abhishek
For SQL Server 2000:
对于 SQL Server 2000:
SELECT su.name,so.name,so.crdate,*
FROM sysobjects so JOIN sysusers su
ON so.uid = su.uid
WHERE xtype='U'
ORDER BY so.name