none
trigger and bitmask

    질문

  • hi all,

    i have a table where the column to change has the id 6 and 8, I check with this query:

      SELECT TABLE_NAME, COLUMN_NAME,  COLUMNPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME),  COLUMN_NAME, 'ColumnID') AS COLUMN_ID  
      FROM INFORMATION_SCHEMA.COLUMNS  
      WHERE TABLE_NAME = 'CMD_E_ENTITIES';

    my bitmask is 160 calculated so:

      select power( 2, ( 6-1 ) )
           + power( 2, ( 8-1 ) )

    now in the my trigger I do:

      if ( COLUMNS_UPDATED() & 160 ) > 0
      BEGIN

    but the if return 0 and my code is not executed.

    this sample is the same of:

    https://docs.microsoft.com/it-it/sql/t-sql/functions/columns-updated-transact-sql?view=sql-server-2017#column-sets

    but if I try the sample it works, but my code not.

    any help?

    D.

    2018년 5월 18일 금요일 오전 10:41

답변