SETUSER not allowed in procedures, triggers, events, or batches

Error constant SQLE_SETUSER_NOT_IN_PROCEDURES
ODBC 2 State ERROR
ODBC 3 State ERROR
Severity 16
SQLCODE –877
SQLSTATE 42W09
Sybase error code 13888
Probable cause

The SETUSER statement is not allowed in stored procedures, triggers, event handlers, or batches, and cannot be called from an EXECUTE IMMEDIATE statement.