4

I have a regular table in SQL Server 2012 and I want to sort the data in a certain query by creation date of the records.

The problem is I don't have a column that holds this data for each record.

Is there a way of doing that without the designated column?

Maybe there is some kind of a built-in creation date information that exists in the database and I can access it somehow...

1
  • 1
    If your table has an identity column which is also the table's clustered index. You may have some luck by sorting with that column. In general it will give you a good indication of the creation order. Commented Sep 15, 2015 at 22:40

2 Answers 2

1

If you don't have a date column, you cannot sort by created date. There is no built-in create date per row that I know of. You have some other options though. If you have an identity column (auto increment), you can order by that to find which row was added first.

You could perhaps use the location of the row in data pages like this answer mentions: Equivalent of Oracle's RowID in SQL Server

Sign up to request clarification or add additional context in comments.

Comments

0

There is no built-in creation date information for rows.

There are some (commercial) tools that can sometimes extract that information from the transaction logs. That's a capability used in emergencies, not during normal operations.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.