![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have created the following Trigger. It is a test as I have not had to do this before. What I am trying to achieve is to trigger when a record is inserted, and then to display a value from that inserted row (in this case the document number). However, I get the error "The multi-part identifier "SOPOrderReturn.DocumentNo" could not be bound" Any ideas? Any help gratefully received. Mark Create TRigger Test On SOPOrderReturn For Insert as DECLARE @DocNo nvarchar(20) SET @DocNo = SOPOrderReturn.DocumentNo RAISERROR ('Test Error Message', 16, 1) |
#3
| |||
| |||
|
|
Hi all, I have created the following Trigger. It is a test as I have not had to do this before. What I am trying to achieve is to trigger when a record is inserted, and then to display a value from that inserted row (in this case the document number). However, I get the error "The multi-part identifier "SOPOrderReturn.DocumentNo" could not be bound" Any ideas? Any help gratefully received. Mark Create TRigger Test On SOPOrderReturn For Insert as DECLARE @DocNo nvarchar(20) SET @DocNo = SOPOrderReturn.DocumentNo RAISERROR ('Test Error Message', 16, 1) |
#4
| |||
| |||
|
|
1. The inserted trigger operates after all the inserts are done, so if you insert more than one document, this will fail. 2. Use the 'special' table name 'inserted' to represent the new data. See below Iain Create TRigger Test On SOPOrderReturn For Insert as DECLARE @DocNo nvarchar(20) SET @DocNo = (select top 1 DocumentNo from inserted) RAISERROR ('Test Error Message', 16, 1) On Mon, 9 Aug 2010 02:54:44 -0700 (PDT), Markei54545 mark.black... (AT) gmail (DOT) com> wrote: Hi all, I have created the following Trigger. It is a test as I have not had to do this before. What I am trying to achieve is to trigger when a record is inserted, and then to display a value from that inserted row (in this case the document number). However, I get the error "The multi-part identifier "SOPOrderReturn.DocumentNo" could not be bound" Any ideas? Any help gratefully received. Mark Create TRigger Test On SOPOrderReturn For Insert as DECLARE @DocNo nvarchar(20) SET @DocNo = SOPOrderReturn.DocumentNo RAISERROR ('Test Error Message', 16, 1)- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |