SQL Server表创建日期查询

时间:2022-04-03 12:58:04

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表的表创建日期?我在物理上看不到任何表,但是我可以查询那个特定的表。

5 个解决方案

#1


103  

For 2005 up, you can use

对于2005年的up,您可以使用

SELECT
        [name]
       ,create_date
       ,modify_date
FROM
        sys.tables

I think for 2000, you need to have enabled auditing.

我认为在2000年,你需要启用审计。

#2


27  

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]

#3


12  

SELECT create_date
FROM sys.tables
WHERE name='YourTableName'

#4


4  

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

#5


0  

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

#1


103  

For 2005 up, you can use

对于2005年的up,您可以使用

SELECT
        [name]
       ,create_date
       ,modify_date
FROM
        sys.tables

I think for 2000, you need to have enabled auditing.

我认为在2000年,你需要启用审计。

#2


27  

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]

#3


12  

SELECT create_date
FROM sys.tables
WHERE name='YourTableName'

#4


4  

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

#5


0  

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