• There's all sorts of things. You're trying to use a stored procedure (OH_Message) as a function. You're trying to assign a value to a variable (@status) without a SET or SELECT keyword. You're trying to use a column (items) from a table without a FROM clause. And, although it's not actually incorrect, this is bad practice: you're using a cursor where a SET based operation is likely to be simpler and faster.

    John