Escaping T-SQL Keywords
If you want to use reserved words as table or column names, you have 2 options:
use brackets (the SQL-Server's way): SELECT [Kill]
or double-quotes* (the ANSI/ISO standard): SELECT "Kill"
Your whole statement would become:
SELECT [serial], [Kill]
FROM tbl_pvporderview
WHERE [Kill] > (?)
ORDER BY [Kill] DESC ;
*: Of course, using double quotes (SELECT "Kill"
) would necessitate that QUOTED_IDENTIFIER
is ON
. You may encounter databases that the setting is still SET OFF
.
Wrap the column name in square brackets:
$sql = "SELECT [Kill] FROM tbl_pvporderview";