SQL Server table creation date query
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.
Get the list of tables created on any date?
SELECT *
FROM sys.tables
WHERE create_date >= '20120914' AND create_date < '20120915'
Find the date/time a table's column was created
There's this system table named sys.Columns that you can get columns information from it.
if you want to see columns of a particular table you can do as follows:
SELECT col.* from sys.objects obj
inner join sys.columns col
on obj.object_Id=col.object_Id
and obj.Name=@tableName
Or you can get table information like this:
SELECT * FROM sys.objects WHERE Name=@tableName
but I couldn't find any information on creation date of a column.
Updated:
This might help.
SQL Statement That Will Get Table Schema And Created Date
The create_date
field is stored in sys.tables
. You can then join back to sys.schemas
to get the schema name.
Something like this:
declare @SqlStatement varchar(max)
select @SqlStatement = COALESCE(@SqlStatement, '') + 'DROP TABLE [TMP].' + QUOTENAME(t.name) + ';' + CHAR(13)
from sys.tables t
join sys.schemas s on t.schema_id = s.schema_id
where s.name = 'TMP'
and t.create_date > dateadd(day,-1,getdate())
print @SqlStatement
Creation date column in SQL table
ALTER TABLE table
ADD column NOT NULL DEFAULT (GETDATE())
Getting the creation date of an entry in SQL Server table
AFAIK- No, unless you have a field for that and you are setting it when doing INSERT/UPDATE
Related Topics
Rails/Postgres: "Must Appear in the Group by Clause or Be Used in an Aggregate Function"
Unexpected Results from SQL Query with Between Timestamps
Pros/Cons of Storing Serialized Hash VS. Key/Value Database Object in Activerecord
Select into with More Than One Attribution
How to Include Excluded Rows in Returning from Insert ... on Conflict
Exporting a Clob to a Text File Using Oracle SQL Developer
Using Django How to Combine Two Queries from Separate Models into One Query
How to Add a Subtotal Row in SQL
How to Set a Default Row for a Query That Returns No Rows
Stored Procedure Exec VS Sp_Executesql Difference
Count(Id) VS. Count(*) in MySQL
Setting Up Rails to Work with SQLserver
Rodbc SQLquery() Returns Varchar(255) When It Should Return Varchar(Max)