Skip to content

Instantly share code, notes, and snippets.

@leekelleher
Last active October 3, 2017 14:10
Show Gist options
  • Save leekelleher/5300219 to your computer and use it in GitHub Desktop.
Save leekelleher/5300219 to your computer and use it in GitHub Desktop.
Umbraco - Find nodes with specific property value
DECLARE @propertyAlias NVARCHAR(50);
DECLARE @search NVARCHAR(50);
SET @propertyAlias = 'bodyText';
SET @search = 'whatever';
SELECT
n.id,
n.path,
n.text
FROM
cmsPropertyData AS pd
INNER JOIN umbracoNode AS n ON n.id = pd.contentNodeId
INNER JOIN cmsDocument AS d ON n.id = d.nodeId
INNER JOIN cmsPropertyType AS t ON t.id = pd.propertytypeid
WHERE
d.newest = 1 AND d.versionId = pd.versionId
AND t.Alias = @propertyAlias
AND
(
pd.dataNvarchar LIKE ('%' + @search + '%')
OR
pd.dataNtext LIKE ('%' + @search + '%')
)
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment