SQL Server 2008 - Trigger not reading column names with spaces
I have been using SQL Server 2008 for about a year now and my knowledge is steadily progressing.
Recently I asked a question on how to implement and audit table on the database I am using in SQL Server 2008. I was successfully able to deploy triggers on a test table following the advice from my previous questi开发者_运维知识库on SQL Server 2008 - Auditing Change Data Capture
In the database I am using during it's design stage (before my time) some condoned principals were applied which included creating tables and column names with spaces in the title. As a result I have noticed that this causes a problem when setting a trigger on a table that has these characteristics.
So my question is how do I in my trigger script allow for spaces on the table and column names without re designing all the tables?
Refer to your table (or columns) like this:
[table name]
Use the square brackets.
精彩评论