In this case I'm putting together the query for someone that is familiar with SQL but not Umbraco or Luke so I'm trying to keep it simple for them.
I've come up with the following which produces what I wanted.
select
CAST([xml] as XML) as xmldata
Into #xmlmembers
from [abc_umbraco].[dbo].[cmsContentXml]
where xml like '%nodeType="1085"%'
select
xmldata.value('(/node/@id)[1]','nvarchar(max)') as [id],
xmldata.value('(/node/@createDate)[1]','nvarchar(max)') as createDate,
xmldata.value('(/node/@nodeName)[1]','nvarchar(max)') as [name],
xmldata.value('(/node/@loginName)[1]','nvarchar(max)') as [loginName],
xmldata.value('(/node/@email)[1]','nvarchar(max)') as [email],
xmldata.value('(/node/company)[1]','nvarchar(max)') as [company]
from #xmlmembers
drop table #xmlmembers
How to query the cmsContentXml table in SQL?
I have a requirement to generate a list of members along with some details and the created date.
I think I want to generate an SQL query that will do this.
The data I need is all in the cmsContentXml table's [xml] field stored as ntext which makes it difficult to query.
Normally the standard query I'd run would be:
SELECT nodeName, createDate FROM cmsContentXml WHERE nodeType='1085'
But how can I do this with the data in the ntext field?
Kind regards,
Matt
Hi Matt
I would recommend you to get all data from Examine index. Query database directly isn't the best way to work with Umbraco tasks.
Look please how to do it with Examine - https://our.umbraco.org/documentation/reference/searching/examine/
Examine is unbelievable fast and you can add to index any custom data.
Thanks
Alex
Thanks Alex,
It had not occurred to me to use Examine.
In this case I'm putting together the query for someone that is familiar with SQL but not Umbraco or Luke so I'm trying to keep it simple for them.
I've come up with the following which produces what I wanted.
Thanks, Matt
Hi Matt
Thank you for sharing solution!
Have a great day.
Alex
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion