Sql – When naming columns in a SQL Server table, are there any names I should avoid using


I remember when I was working with PHP several years back I could blow up my application by naming a MySQL column 'desc' or any other term that was used as an operator.

So, in general are there names I should avoid giving my table columns?

Best Solution

As long as you surround every column name with '[' and ']', it really doesn't matter what you use. Even a space works (try it: [ ]).

Edit: If you can't use '[' and ']' in every case, check the documentation for characters that are not allowable as well as keywords that are intrinsic to the system; those would be out of bounds. Off the top of my head, the characters allowed (for SqlServer) for an identifier are: a-z, A-Z, 0-9, _, $, #.