I am associated with Proficy Historian, which allows the use of periods in column names. Since the data is stored in a format different from the DBMS, I can not use openquery to receive data, since there is no established scheme for tables. So to get the data, I have to use a four-part name syntax. This example works:
SELECT * FROM iHist...[SELECT * FROM ihTrend]
but this does not work with the wrong syntax near '.'.
SELECT * FROM iHist...[SELECT [SERVER.pid_astatus[07][0].F_CV.Value] FROM ihTrend]
where SERVER.pid_astatus[07][0].F_CV.Value is the column name
This also does not work with the wrong syntax next to the 'from' keyword.
SELECT * FROM iHist...[SELECT [SERVER.pid_astatus[[07]][[0]].F_CV.Value] from ihTrend]`
Any ideas on how I can get SQL Server to see this as a column?
EDIT:
Martins' suggestion of correct brackets to escape brackets only works outside of sql call
SELECT [SERVER.pid_astatus[07]][0]].F_CV.Value] FROM iHist...[SELECT * FROM ihTrend]
However, it does not work inside the Invalid syntax next to the 'from' keyword.
SELECT * FROM iHist...[SELECT [SERVER.pid_astatus[07]][0]].F_CV.Value] FROM ihTrend]
EDIT
SELECT * FROM iHist...[SELECT [SERVER.pid_astatus[07]][0]].F_CV.Value]] FROM ihTrend]
I needed to avoid the column escape sequence :)
source share