Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set CONTEXT_INFO = NULL?

I use CONTEXT_INFO to skip triggers as such:

IF CONTEXT_INFO() = 0x676E6F7468692073656175746F6E RETURN

and in my PROC:

IF CONTEXT_INFO() IS NOT NULL SET @CONTEXT_INFO = CONTEXT_INFO() -- to restore later
SET CONTEXT_INFO 0x676E6F7468692073656175746F6E

How do you set it back to NULL if you needed to? SET CONTEXT_INFO = NULL does not work. Am I missing something obvious?

like image 905
SQLMason Avatar asked Jan 19 '12 15:01

SQLMason


1 Answers

Just use

SET CONTEXT_INFO 0x /*Gets padded with zeros when cast to binary(128)*/

You don't set it to NULL. If you look at

select context_info
from sys.sysprocesses

You will see that it is not NULL for any of the connections.

like image 132
Martin Smith Avatar answered Oct 03 '22 04:10

Martin Smith