When I write SQL I tend to never use the schema as it is always dbo
and I only tend to use square brackets round column names if they are a keyword such as [datetime]
(Don't shoot me I didn't design these databases!) or if there are spaces in such as [Order Date]
.
My question is should I be using these all the time or is it a better practise to just use them when required such as in the cases above? I have noticed whenever you get SSMS to create the SQL it does conform to this - even putting square brackets round the data types.
What would you guys consider best practise in this case?