Here is an issue that annoys me but I also am hoping someone out there can provide a resolution. We have a third party vendor/app that handles one aspect of our transactions. I am using OpenQuery to try and query this table via the linked server. Here's the catch (and a source of frustration)- the table I am trying to query has over 110M records and uses reserved words as column names (Date, Time). Specifically I am trying to query a subset based on date so that I don't have to try and pull the entire table each time and then subset it after pulling the entire thing but trying to use a where clause that references the date column, for example, is posing issues because of the reserved word.
Anyone have a solution to this? Thanks in advance.
T-SQL uses brackets [] around reserved words and names with illegal characters such as a dash or space.
You can alias the column names to make it easier if needed. You can safely use brackets around many additional words if you are unsure.
Example query provided to show flexibility in the syntax.