One of my columns is called from
. I can't change the name because I didn't make it.
Am I allowed to do something like SELECT from FROM TableName
or is there a special syntax to avoid the SQL Server being confused?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
These are the two ways to do it:
While you are doing it - alias it as something else (or better yet, use a view or an SP and deprecate the old direct access method).
The following will work perfectly:
Your question seems to be well answered here, but I just want to add one more comment to this subject.
Those designing the database should be well aware of the reserved keywords and avoid using them. If you discover someone using it, inform them about it (in a polite way). The keyword here is reserved word.
More information:
and
You can put your column name in bracket like:
Or
Put in a temprary table then use as you like.
Example:
Here I just assume that your_tablename contains only one column (i.e. from).
In Apache Drill, use backquotes: