Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
toniolo
Starting Member
14 Posts |
Posted - 2007-06-02 : 20:19:04
|
| Hello,I have limited knwoledge in TRANSACT-SQL and would like to ask someone's assistance in a problem I have.Please let me explain what I need.I have an application that runs on MSDE2000.This application issues some labels for customers and every day I have to enter a new code on the application that must be valid for only the same day. I can use more than one code on the same day, but NEVER on different days.What happens at the moment is that sometimes the operator forgets to change the code and the same code is used in more than one day causing a lot of problems.The question is. How can I lock the database so the code can be used in ONLY one day ? Let me give you an example:First DayName Date Code Label#John 06/01 1234 101Mark 06/01 1234 102Mary 06/01 1234 103Following Day (note that more than one code can be used on the same day):Name Date Code Label#John 06/02 5678 104Mark 06/02 5678 105Mary 06/02 7789 106Third day (Please note the mistake. The operator forgot to change the Code on the application and the same code has been used on 2 different days):Name Date Code Label#John 06/03 7789 107Mark 06/03 7789 108Mary 06/03 7789 109I believe that this could be solved with a TRIGGER. Every time a new label is generated it checks to see if the Code has been used on the previous day.Not sure if this is the correct way though.I would appreciate any help or idea.Thank you very much.Marcelo |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
|
|
toniolo
Starting Member
14 Posts |
Posted - 2007-06-03 : 02:02:04
|
| I made a mistake, sorry.I first put my post here then I realized it was Transact-SQL 2005.Then I created the same post on the 2000 forum.You can deleted this post if you want.Thanks. |
 |
|
|
|
|
|