Using sp_tableoption to change “text in row”

sp_tableoption is used to turn on/off features on tables like turn on the text in row feature for datatype text, ntext, or image columns, pinning a table, table lock on bulk insert.

Example: Enables the 'text in row' option on customers table inline limit to 1000
EXEC sp_tableoption 'customers', 'text in row', '1000'

Using “OBJECTPROPERTY” one can print the current setting
SELECT OBJECTPROPERTY(object_id('customer'), 'TableTextInRowLimit') — To print text in row limit
SELECT OBJECTPROPERTY(object_id('customer'), 'TableIsLockedOnBulkLoad') — To print isTableLockedOnBulk load
SELECT OBJECTPROPERTY(object_id('customer'), 'TableIsPinned') — To print if table is pinned

Advertisements

How to list triggers on a database in SQLServer?

Using the following SQL statement, it will list triggers on database. It also prints trigger name, table the trigger is on, is it a insert, update and delete triggering event, after and instead of trigger, if the trigger is enabled or disabled

SELECT trigger_name = name
, trigger_owner = USER_NAME(uid)
, table_name = OBJECT_NAME(parent_obj)
, isinsert = OBJECTPROPERTY( id, ‘ExecIsInsertTrigger’)
, isupdate = OBJECTPROPERTY( id, ‘ExecIsUpdateTrigger’)
, isdelete = OBJECTPROPERTY( id, ‘ExecIsDeleteTrigger’)
, isafter = OBJECTPROPERTY( id, ‘ExecIsAfterTrigger’)
, isinsteadof = OBJECTPROPERTY( id, ‘ExecIsInsteadOfTrigger’)
, status = CASE OBJECTPROPERTY(id, ‘ExecIsTriggerDisabled’) WHEN 1 THEN ‘Disabled’ ELSE ‘Enabled’ END
FROM sysobjects
WHERE type = ‘TR’

Output:
tr_test1_insert dbo test1 1 0 0 1 0 Enabled