Skip to main content
7-Bedrock
May 20, 2024
Solved

ThingWorx SQL Query

  • May 20, 2024
  • 1 reply
  • 1331 views

Hi all,

 

I have to run a query on MS SQL Database table, which has columns with spaces in their names (ex: 'SA03 LH CS BRG DEPTH (mm)').

How do I query this successfully?

Here is an example query:

 

SELECT *

FROM <<tableName>>

WHERE <<tagName>> != 0;

 

Here <<tagName>> is a column with space in its name.

 

Best answer by Arun_C

Hi @PSB ,

 

I have tried in MS SQL DB. Kindly find the below atttached snapshot for your references.

Arun_C_0-1716274835044.png

Thanks & Regards,

Arun C

 

 

1 reply

16-Pearl
May 20, 2024

Hi @PSB ,

 

I have tried with PostgreSQL Query. It is working for me.

SELECT * FROM public.accounts where "SA03 LH CS BRG DEPTH (mm)" = 1

 

Arun_C_0-1716216775516.png

Thanks & Regards,

Arun C

 

PSB7-BedrockAuthor
7-Bedrock
May 21, 2024

Hi @Arun_C ,

 

PFA screenshot, I have tried it on MS SQL it doesn't seem to be working.

Screenshot 2024-05-21 100135.pngScreenshot 2024-05-21 102027.png

 

Can you try it on MS SQL & let me know.

 

Arun_C16-PearlAnswer
16-Pearl
May 21, 2024

Hi @PSB ,

 

I have tried in MS SQL DB. Kindly find the below atttached snapshot for your references.

Arun_C_0-1716274835044.png

Thanks & Regards,

Arun C