I've got some old SQL scripts which I used quite a while ago to get propertydata from the tables, based on a nodeid.
But it's old and doesn't work anymore.
I've searched the internet and forum, but can't fint a script that works, and can't get my head around the SQL structure.
Does anybody have a SQL script that returns the latest version of propertydata based on a nodeid from umbracoNode table?
Insert usual warnings here about directly accessing content via SQL to the db, use the Umbraco Cache instead if presenting this data on a website etc etc
that aside would something like this work for you?
Select * from umbracoPropertyData upd INNER JOIN umbracoContentVersion ucv ON upd.versionId = ucv.Id WHERE ucv.[current] = 1 AND ucv.Nodeid = 1321
Essentially because Umbraco stores tons of versions of the same page, the umbracoContentVersion table tracks which is the 'current' version based on a flag called 'current' - and it also includes the NodeId, so then you can just join this to the umbracoPropertyData table on the 'VersionId' and you'll get all the data for all the properties on that node for the 'current version'
Get propertydata with SQL based on nodeID
I've got some old SQL scripts which I used quite a while ago to get propertydata from the tables, based on a nodeid. But it's old and doesn't work anymore.
I've searched the internet and forum, but can't fint a script that works, and can't get my head around the SQL structure.
Does anybody have a SQL script that returns the latest version of propertydata based on a nodeid from umbracoNode table?
Hi Kristoffer
Insert usual warnings here about directly accessing content via SQL to the db, use the Umbraco Cache instead if presenting this data on a website etc etc
that aside would something like this work for you?
Essentially because Umbraco stores tons of versions of the same page, the umbracoContentVersion table tracks which is the 'current' version based on a flag called 'current' - and it also includes the NodeId, so then you can just join this to the umbracoPropertyData table on the 'VersionId' and you'll get all the data for all the properties on that node for the 'current version'
regards
marc
Hey Marc
Perfect. That solves my issue 100% :-)
Thank you
It's not an option to do it codewise, since it's an external agency that needs to be able to fetch specific data from the database directly.
And yes, warnings have been made for the client :-)
/Kristoffer
is working on a reply...