Home Forums SQL Server 7,2000 T-SQL Using Variables as column names in select statement RE: Using Variables as column names in select statement

  • Hi Vladan,

    thx for the input, I discussed my proposed solution with client and supervisor and the triggers will only be used on 2 tables as these tables carry counters that are updated in code, thus only the columns that changed must be updated if record exists in other database. the rest of the lookup tables will be repopulated with the master database records with a dts package that calls a sp.

    I created a update and insert trigger for the 1st table and tested, works absolutly brilliant. The only reason that I wanted to call alias.@column was to make the scripts generic, as there are only 2 tables that are going to use the triggers I decided to make unique triggers for each, 4 triggers to maintain isn't that big of a deal for me so I am happy with the result.

    PS I also considered using an audit table as you suggested, but my supervisor did not agree, so what the boss wants the boss gets i suppose.

    thx again for the input.