Jump to content

Field status change


atl_andy

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.