Probably, it's your insert statement:
Insert Into @RtnValue (value)
Since you don't specify the columns, it will try to insert your
into the first column - which is identity - and fail because:
1) You can't write to an an Identity column
2) You can't write a null into your Value column.
Try specifying the columns:
INSERT INTO @RtnValue (Value) VALUES (value)
Or see here: Converting comma separated data in a column to rows for selection
] which does much the same thing.