Constructing a SQL Server query for the first time today, and was surprised to see that this alias didn’t work:
SELECT
INVOICE_INVOICE_NUMBER AS invno,
INVOICE_INVOICE_SEQ AS lineno
FROM
INVOICED
But this did:
SELECT
INVOICE_INVOICE_NUMBER AS invoice,
INVOICE_INVOICE_SEQ AS line
FROM
INVOICED
Changing the alias name is no big deal – but it would be good to know why this particular alias didn’t work and how I can prevent or be aware of any future keywords to avoid.
LineNois a reserved word. You can encase it in brackets to use it.Reserved words