views:

28

answers:

1

Given:

  • I added a non-nullable foreign key to a table.
  • I settled on a way to populate the foreign key with default values.
  • I checked in both changes to a re-runnable DB creation script.
  • Other developers ran this script, and now they have the foreign key populated with default values on their developer machines.

A few days later however...

  • I changed my mind.
  • Now I'd like to populate the foreign key's default values differently.

My Question:

Can SQL Server or INFORMATION_SCHEMA tell me when SQL objects were created?

Ideally, I'd like to drop and re-add the foreign key if it was created before a certain date/time.

Any help or alternative strategies would be greatly appreciated.
Obviously, I'd like to avoid going to each developer's cube, asking them to drop the foreign key manually.

+2  A: 

For SQL 2000 sysobjects (for SQL 2000), column crdate

For SQL 2005+ sys.objects, create_date and modify_date

gbn

related questions