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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Help with Transact-SQL Trigger

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 Day

Name Date Code Label#
John 06/01 1234 101
Mark 06/01 1234 102
Mary 06/01 1234 103


Following Day (note that more than one code can be used on the same day):

Name Date Code Label#
John 06/02 5678 104
Mark 06/02 5678 105
Mary 06/02 7789 106


Third 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 107
Mark 06/03 7789 108
Mary 06/03 7789 109



I 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

Posted - 2007-06-03 : 00:06:20
dupe: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=84449

if you have an issue on MSDE, why post in a 2005 forum?


www.elsasoft.org
Go to Top of Page

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.
Go to Top of Page
   

- Advertisement -