update

  • 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?

  • 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

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

  • 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

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/


  • 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

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/


  • 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

    steve@dkranch.net

  • 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

    steve@dkranch.net


  • should. If you do the select, do you get results?

    Steve Jones

    steve@dkranch.net

  • 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