Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi Community,
I am exploring my MS Sql database as persistence provider and was going through it's table structure. I need to perform simple query to fetch all entities with name as custom name mentioned while creating a thing in Thingworx Platform.
For example I created a thing with name as "MailRepository_Th" . How can I query this directly from database,
I am using following query which doesn't work an expects a column name only.
Query : "SELECT [entity_id],[name],[thingTemplate]
FROM [ThingworxHome].[dbo].[thing_model]
where name = "MailRepository_Th"
Kindly suggest.
Regards,
Sid
Solved! Go to Solution.
Use single quotes ' ' in the filter condition (WHERE).
Use single quotes ' ' in the filter condition (WHERE).
Is there a reason the snippets that are provided for this reason (SpotlightSearch) were not used in this scenario?
It is important to note that querying directly the persistence provider SQL table is neither supported or recommended.
The persistence provider table structure is internal to ThingWorx, and its structure is not guaranteed to be fixed (eg: the SQL query you specified could run now, but in the next version could fail)
Depending on the usecase, there are reasons to use the internal table, but I want to make sure that when others will look at this thread won't think to directly access the database for such purpose.
It was only for exploring persistence provider tables to see how it behaves internally and how it stores data.
Thanks.