SQL Server table creation date query
SqlSql ServerTsqlSql Server-2005Sql Problem Overview
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 Solutions
Solution 1 - Sql
For 2005 up, you can use
SELECT
[name]
,create_date
,modify_date
FROM
sys.tables
I think for 2000, you need to have enabled auditing.
Solution 2 - Sql
For SQL Server 2005 upwards:
SELECT [name] AS [TableName], [create_date] AS [CreatedDate] FROM sys.tables
For SQL Server 2000 upwards:
SELECT so.[name] AS [TableName], so.[crdate] AS [CreatedDate]
FROM INFORMATION_SCHEMA.TABLES AS it, sysobjects AS so
WHERE it.[TABLE_NAME] = so.[name]
Solution 3 - Sql
SELECT create_date
FROM sys.tables
WHERE name='YourTableName'
Solution 4 - Sql
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
Solution 5 - Sql
For 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