• Thanks Raleigh. I dont want to assign the result of the select to a variable but i want to use the variable(which has the field name) in the select list to get the value of the field.

    The reason why i need this is in the audit table trigger, I get the field name of the primary key

    SELECT @primarykey-2 = COLUMN_NAME

    fromINFORMATION_SCHEMA.TABLE_CONSTRAINTS pk ,

    INFORMATION_SCHEMA.KEY_COLUMN_USAGE c

    where pk.TABLE_NAME = @table_name

    andCONSTRAINT_TYPE = 'PRIMARY KEY'

    andc.TABLE_NAME = pk.TABLE_NAME

    andc.CONSTRAINT_NAME = pk.CONSTRAINT_NAME

    I want to use the @primarykey-2 in my select to get the primary key value. Also using the COLUMNS_UPDATED() function i find out the fieldnames which was updated. I need to use the field names in the select list to get the value of the field.

    Thank You. i appreciate your reply.