Last active
October 3, 2017 14:10
-
-
Save leekelleher/5300219 to your computer and use it in GitHub Desktop.
Umbraco - Find nodes with specific property value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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