How to Select Column Which Field Name Contains a Dot

How to SELECT column which field name contains a dot

I finally found how to retrieve data from this column.

You need to replace "." by "#" and put the column name in square brackets or backsticks :

QUERY_SQL = _
"SELECT `Col#1`, Col3 FROM [table$] " & _
"IN '" & SourcePath & "' " & CHAINE_HDR

However this will not work in INSERT INTO queries. :

INSERT INTO [sheet$] (Col2, `Col#4`) IN '" & TargetPath & "' 'Excel 12.0;' " & QUERY_SQL

While this is less problematic for me as I can rename all field in the target sheets, this is still a strange behaviour.

How do I select columns which has a dot in their column names

The issue is that you're using single quotes ( ' ) around your column name, rather than using backticks ( ` ).

Try using this instead:

SELECT   * 
FROM Users
WHERE `local.email` = 'burgundy@email.com'
LIMIT 1

How to access the column name which contains dot . in select query

Do you try with [] ?

select [complaintlgeo].[lat] from mandapet.pgr_view

or

select [complaintlgeo.lat] from mandapet.pgr_view

How to write a column name with dot (.) in the SELECT clause?

Just enclose it in square brackets, and it will work

e.g.

SELECT MAX(Value) AS [PrmTable.Value]
FROM TempTable

How to Reference a Pandas Column that has a dot in the name

Using the replace command to remove offensive characters works ok: Removing space from dataframe columns in pandas.

Accessing column data with multiple dot in column name in MySql

The best idea would probably be to avoid this issue to begin with and use column names that don't have any special characters. If this isn't possible, you can use backticks to escape column names:

SELECT `DATA.COM.WITH.123.VALU` FROM Datacom; 
-- Here^----------------------^

Updating a PostgreSQL column that contains dot (.) in its name

You can use "" around the column name

How to handle dot symbol in Excel Column names while using excel as a database

Your assumption is correct; the driver doesn't like the . in your column name. Turns out, we can get it to tell us the answer too:

Sample Image

By making the driver select everything into a datatable and having a look at what it did (point to the datatable in the debugger, click the magnifying glass to open the visualizer), we can see that . in column names are converted to # - if you craft your column names to the same rule, it works



Related Topics



Leave a reply



Submit