atl_andy Posted March 24, 2008 Share Posted March 24, 2008 Is there a way to limit data from being entered into a row? Example: I have 3 rows of data in my database: ProjectNumber ModelNumber SerialNumber Open/Closed 12345 xyz 234234 Open 12345 xzs 13514 Open 12345 asdf 13451 Open I would like to flag everything for project 12345 so that no more data can be entered using that project number, once it is complete. Maybe there is an update I can run to mark it as such? By changing the status to closed. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 25, 2008 Share Posted March 25, 2008 I would create Projects table (if you haven't already). The primary key would be ProjectNumber, then there could be other info about it like Title, Owner, etc. Then, have a final datetime column called closed_dttm. Leave this column null while open, then fill it with the date when closed. Make sense? Quote Link to comment Share on other sites More sharing options...
btherl Posted April 10, 2008 Share Posted April 10, 2008 You could create a trigger on update which checks to see if a row is open or closed, if you want to prevent changes directly in SQL. But I think it makes more sense to check it in the software. If someone wants to add a row, first check the table to see if there are any rows that are closed and have matching project number. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.