Solved

sql server 2005 record insertion dates to be found out.

Posted on 2010-11-26
8
405 Views
Last Modified: 2012-06-22
I have a products table in sql server 2005. I have got it from the client. Can i know the date and time when a particular product has been inserted? I have no column like date time in the table. I suppose there should be some in built stored procedure which can tell the date and time when the insertion into the product table for a product was made. this way  I can discover the creation of each products?

can anyone help please?
0
Comment
Question by:Dinesh Kumar
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 34216459
no.

unless, as you said, that you have the column ...
or you have the time to compare the full backups of the db of when the record(s) appeared, and eventually then read the archive logs to see the exact time of the inserts ...
0
 

Author Comment

by:Dinesh Kumar
ID: 34216496
I see there is a view which can help i.e select * from sys.dm_db_index_usage_stats
0
 

Author Comment

by:Dinesh Kumar
ID: 34216510
can you explain it little bit more
read the archive logs to see the exact time of the inserts ...
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 42 total points
ID: 34216544
some third-party tools allow to read the transaction logs ...
http://www.sqlmag.com/article/log-files/can-the-transaction-log-tell-us-what-happened-.aspx

lumigent, red gate etc ,...
0
 
LVL 26

Assisted Solution

by:Zberteoc
Zberteoc earned 42 total points
ID: 34217162
The log file approcah would work only if you have all the log files from the moment the database was created. Even so I don't see an easy way to look for each product in multiple log files and beside that I am not sure that yiu have a timestamp in the log file either to show you when a particular insert happened.

Point is what you are asking is quite impossible.

May I ask why do you need this info? Maybe we can find a workaround or even find that is not needed if we would know the reason.

What I could suggest is to add 2 more columns to your table, datecreated and lastupdated and for now set them to the date when you got the backup from your client and make it like a starting point.
0
 

Author Comment

by:Dinesh Kumar
ID: 34217185
The reason is I want to show only those products which are created in last 6 months through a new link added on the website that says New Products.
0
 
LVL 26

Expert Comment

by:Zberteoc
ID: 34217204
Can you ask your client if they can provide even an approximate info about this? It's still better than nothing. After all is their job to know and provide this kind of info, not yours to dig out of nothing. You should tell them and explain why is not possible for you to find it.

Good luck!
0
 
LVL 3

Assisted Solution

by:GSGDBA
GSGDBA earned 41 total points
ID: 34218016
HI,

I suppose you will be able to find some tables with some relationship to each other.
Could you please check the Foreign Keyscolumns referenced from other table to product and product to other tables.

If you are able to see the existence of relationship between tables. Check does those referenced tables have date related column.


.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question