Hi All,I'm using a trigger for insert in my SQL server 200 DB:CREATE TRIGGER PAT_INSERT ON PATIENT FOR INSERT AS BEGIN SELECT PATIENTCODE FROM INSERTED UPDATE PATIENT SET BARCODE=PATIENT.BARCODE FROM INSERTED WHERE PATIENT.PATIENTCODE = INSERTED.PATIENTCODE END
As you see there's a select from inserted. This is used in an ASP page in order to get the primary key just inserted and it works fine.The question is:is there a way to catch the result from this trigger (i.e. the selected key) in the query analyzer? I hope my question will be more clear with this "pseudo"-code:declare @return intselect @return = insert into patient(patientcode, surname, name, dt, pgm, id, risusercode)values(getkey(), 'testinsert', 'testinsert', getdate(), 'test', 1, '0000000000')
I am aware this is obscene, but is only for explain my aim.I hope someone has good idea, bye bye.-snaso.