If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > How to know if a trigger is enable ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-07-11, 11:14
eldeleon eldeleon is offline
Registered User
 
Join Date: Jun 2011
Posts: 17
How to know if a trigger is enable ?

Hello

I have a problem in a sp that i am doing, because some times a trigger its running and its affecting my process, I want to know if there is a way with a code in my sp i can detect if the trigger its enable and then proceed to disable it.

I know that probably something its wrong because I start seeing and increment of looks, then I check with sp_help TRIGER and its enable.

Any help will be apprecieted.

Thank you
Reply With Quote
  #2 (permalink)  
Old 09-07-11, 12:49
pradyut.dhara pradyut.dhara is offline
Registered User
 
Join Date: May 2011
Posts: 28
How to know if a trigger is enable ?

Hi,
You can check the deltrig, instrig, updtrig, sysstat and sysstat2 columns in sysobjects table to see if a trigger is enabled or disabled.
Reply With Quote
  #3 (permalink)  
Old 09-07-11, 14:11
eldeleon eldeleon is offline
Registered User
 
Join Date: Jun 2011
Posts: 17
Do you have an example of this?

Regards
Reply With Quote
  #4 (permalink)  
Old 09-08-11, 10:30
pradyut.dhara pradyut.dhara is offline
Registered User
 
Join Date: May 2011
Posts: 28
How to know if a trigger is enable ?

Hi,
Got the following information from another website. These values are not documented (at least i could not find )
trigger status (enabled/disabled) based on sysstat2 column values for table
sysstat2 & 1048576 (0x100000) != 0 => insert trigger disabled
sysstat2 & 2097152 (0x200000) != 0 => delete trigger disabled
sysstat2 & 4194304 (0x400000) != 0 => update trigger disabled

It is also working in sybase 15.5 developer edition.
Code:
1> select * from sysobjects where (sysstat2 & 2097152)!= 0
2> go
 name                                                                                                                                                                                                                                                            id          uid         type userstat sysstat indexdel schemacnt sysstat2    crdate                     expdate                    deltrig     instrig     updtrig     seltrig     ckfirst     cache  audflags    objspare versionts                  loginame                       identburnmax                              spacestate erlchgts           sysstat3
 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- ----------- ---- -------- ------- -------- --------- ----------- -------------------------- -------------------------- ----------- ----------- ----------- ----------- ----------- ------ ----------- -------- -------------------------- ------------------------------ ----------------------------------------- ---------- ------------------ --------
 titles                                                                                                                                                                                                                                                            768002736           1 U           0     115        2         4     2170880        Jun  8 2011  6:12PM        Jun  8 2011  6:12PM  1104003933           0           0           0           0      0           0        0 NULL                       NULL                                                                NULL       NULL NULL                      0

(1 row affected)
1> select name from sysobjects where id=1104003933
2> go
 name
 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 deltitle

(1 row affected)
1> sp_help deltitle
2> go
 Name     Owner Object_type Object_status Create_date
 -------- ----- ----------- ------------- -------------------
 deltitle dbo   trigger      -- none --   Jun  8 2011  6:12PM

(1 row affected)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On