ObjectProperty returning Null

  • Checking to see if a Trigger is enabled on a table or not.

    I'm running the objectproperty function returning for the system id of the table and the property ExecIsTriggerDisabled. This is returning NULL. I know the id is correct, and I know the property is correct. It returns 1 for "HasInsertTrigger".

    According to BOL NULL means the object doesn't exist (false) or the property doesn't exist (false). It also says you might not have permissions to view the property. I'm sa so I have.

    Any ideas why this is returning NULL?

    Oh and I realise I could just enable the trigger to make sure it is....but the table is replicated so it won't let me without dropping repl first. No thanks.

    Cheers

  • You're supposed to use the object id of the trigger, not the table.

    select objectproperty(object_id('name of trigger'), 'ExecIsTriggerDisabled')

  • Cheers! haha. Works now.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply