
Great this will help me a lot On Mon, Aug 23, 2010 at 2:36 PM, marto <martow@gmail.com> wrote:
Calvin, this is more correct
CREATE TRIGGER [dbo].[T_my_items] ON [dbo].[my_items] FOR UPDATE AS IF UPDATE(received_items) BEGIN declare @rcvd nvarchar(3) SELECT @rcvd = m.received_items from my_items m inner join inserted i on m.id = i.id IF @rcvd = 'yes' begin update my_items set sent_items = m.received_items
from my_items a INNER JOIN INSERTED I ON I.id = a.id end end
On Mon, Aug 23, 2010 at 2:30 PM, marto <martow@gmail.com> wrote:
if i understand your requirement this should work
*CREATE TRIGGER [dbo].[T_my_items]*
* ON [dbo].[my_items]*
*FOR UPDATE*
* AS *
*IF *
*UPDATE(received_items)*
*BEGIN *
*declare @rcvd nvarchar(3) *
*SELECT @rcvd = m.received_items from my_items m*
*inner join inserted i on m.id = i.id *
*IF*
*@rcvd = 'yes'*
*begin *
*update my_items*
*set ManualDocID = m.received_items*
*from my_items a*
*INNER JOIN INSERTED I ON I.id = a.id *
*end*
*end*
On Mon, Aug 23, 2010 at 8:57 AM, Calvin Omari <calvinebarongo@gmail.com
wrote:
Hi Techies, I am used to Mysql triggers but right now am needed to create a MSSQl trigger that does the following I have a table my_items that has a column/field called sent_items and received_items such that if the recieved item is yes the trigger will update the sent items as yes where the id is maintained to allow only required updates
Regards
-- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us.
Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Marto.
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us. Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo