February 15, 2002 at 11:02 am
Have a table (table1) that holds data from users, but does nothing else. When there done inputing data they place the word end in the final row. I would like to a sp_ that would look at this table and send a net send to notify me that they are done with there input based on the word end in the table. Ihv tried some triggers, but that's not happening....any help?
February 15, 2002 at 11:46 am
This doesn't sound like a very efficient process, but if they are editing row by row and they simply enter end in a field on a new row, a trigger would normally work if I am understanding what you are trying to do. A couple of questions:
1) What tool are they using to enter data?
2) Can you post the table (DDL) and trigger?
3) Is there time to do any sort of redesign or rewriting if a better solution can be developed?
K. Brian Kelley
http://www.sqlservercentral.com/columnists/bkelley/
K. Brian Kelley
@kbriankelley
February 15, 2002 at 1:53 pm
quote:
This doesn't sound like a very efficient process, but if they are editing row by row and they simply enter end in a field on a new row, a trigger would normally work if I am understanding what you are trying to do. A couple of questions:1) What tool are they using to enter data?
2) Can you post the table (DDL) and trigger?
3) Is there time to do any sort of redesign or rewriting if a better solution can be developed?
K. Brian Kelley
http://www.sqlservercentral.com/columnists/bkelley/
February 15, 2002 at 2:02 pm
the data is scanned in, real simple just five fields. Just need to figure out the trigger...
IF EXISTS (SELECT rma FROM table1
WHERE rma = 'end' )
Then i would exec the sp_ to send the net send message....
quote:
This doesn't sound like a very efficient process, but if they are editing row by row and they simply enter end in a field on a new row, a trigger would normally work if I am understanding what you are trying to do. A couple of questions:1) What tool are they using to enter data?
2) Can you post the table (DDL) and trigger?
3) Is there time to do any sort of redesign or rewriting if a better solution can be developed?
K. Brian Kelley
http://www.sqlservercentral.com/columnists/bkelley/
February 15, 2002 at 2:19 pm
Is this the only word in the field? If not, you might need to do:
IF EXISTS (SELECT rma FROM table1
WHERE rma like '%end' )
to get end at the end of the field. However, are you then changing these rows? If not, you will constantly be notified about old rows, even if a new tow does not have "end" in the field.
If you really want a trigger, then you probably want to do:
IF EXISTS (SELECT rma FROM inserted
WHERE rma like '%end' )
Steve Jones
February 15, 2002 at 2:37 pm
Yes there's only one word in the field...
Also the table gets cleared nightly...
So you think that the trigger as is should work??
quote:
Is this the only word in the field? If not, you might need to do:IF EXISTS (SELECT rma FROM table1
WHERE rma like '%end' )
to get end at the end of the field. However, are you then changing these rows? If not, you will constantly be notified about old rows, even if a new tow does not have "end" in the field.
If you really want a trigger, then you probably want to do:
IF EXISTS (SELECT rma FROM inserted
WHERE rma like '%end' )
Steve Jones
February 15, 2002 at 3:46 pm
February 15, 2002 at 5:47 pm
Go with the FROM inserted version, as the data does not exist in the table at the point the trigger fires. If you want to catch when they insert %end you will have to look at the inserted table to get.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply