Thursday, September 8, 2011

How to find tables or database objects created in a database on a particular day in Sybase?

While working in database it is sometimes required to get a list of tables or database objects created on a particular day and it is not too hard to find the same. However we just need to keep in mind where to look for this particular set of information and we are done with the problem. As we all know that all the database objects when created in a database are maintained in the sysobjects system table on the Sybase SQL Server or Sybase Adaptive Server Enterprise RDBMS hence the best candidate to tell us the creation date/day of the database object should be the sysobjects system tables.

On looking at the sysobjects table we find that there is infact a crdate column which suggests the date on which date and time of the day a particular database object was created and using this information we can find the correct information that we require. A simple sql statement to find all the datasbase objects created on 1st Jan 2010 would be -

select * from sysobjects where crdate = convert(date, '01/01/2010', 0)

The above sql will list all the database objects created on 1st Jan 2010.

Note: As the above query involves coversion os string to date using convert function hence the syntax may vary based on your date settings.

No comments:

Post a Comment