MichaelF81
Programmer
I created a trigger for whenever data is inserted into a table
name_last = varchar(50)
name_first = varchar(50)
em_id = varchar(150)
I ran an insert statement (very simple and basic)
into this 3 columns, and I get the following errors
I also tried
And I get the same error
"Adults are just obsolete children and the hell with them." - Dr. Seuss
Code:
CREATE TRIGGER trgEmIDIns ON [afm].[em]
FOR INSERT
AS
update afm.em
set em_id = name_last + ', ' + name_first + ' ' + em_id
name_last = varchar(50)
name_first = varchar(50)
em_id = varchar(150)
I ran an insert statement (very simple and basic)
Code:
insert into afm.em (name_first, name_last, em_id)
Values ('Mike', 'Fed', '12345678')
into this 3 columns, and I get the following errors
Code:
Server: Msg 8152, Level 16, State 9, Procedure trgEmIDIns, Line 4
String or binary data would be truncated.
The statement has been terminated.
I also tried
Code:
CREATE TRIGGER trgEmIDIns ON [afm].[em]
FOR INSERT
AS
update afm.em
set em_id = rtrim(name_last) + ', ' + rtrim(name_first) + ' ' + rtrim(em_id)
And I get the same error
Code:
Server: Msg 8152, Level 16, State 9, Procedure trgEmIDIns, Line 4
String or binary data would be truncated.
The statement has been terminated.
"Adults are just obsolete children and the hell with them." - Dr. Seuss