contact us.
call us.
join us.
we respect your data
At Sagittarius, we want to share our passion and excitement for digital. By providing your details you agree to be contacted by us.
We will treat your personal data with respect and you can find details in our Privacy Statement - this includes:
- What information do we collect about you
- How will we use the information about you
- Access to your information and correction
call us.
join us.
win with us.
We exist to make your business thrive and our greatest reward is our returning clients. Our focus is and always will be on our clients and not on industry awards and accreditations, which could account for why we’ve won so many of them…
Finding Locked Items Using the Sitecore Database.

Richard Brisley
We had an issue recently were a number of items were locked in the Sitecore interface.
So to find out which users we needed to ask I created the SQL below. This will output the items effected by locks and the xml for the lock which shows the username and password.
SELECT i.ID AS ItemID, i.Name AS ItemName, FieldItem.Name AS FieldName, f.Value AS FieldValue,
TemplateItem.ID AS TemplateID, TemplateItem.Name AS TemplateName
FROM dbo.Items i
INNER JOIN dbo.Fields f ON i.ID = f.ItemId
INNER JOIN dbo.Items FieldItem ON FieldItem.ID = f.FieldId
INNER JOIN dbo.Items TemplateItem ON TemplateItem.ID = i.TemplateID
WHERE FieldItem.Name = '__Lock'
You could add i.TemplateID to the where clause to only search a particular type of item. If you want to pull out the username and lock time from the xml you can do that quite easily. This is using simple CHARINDEX and SUBSTRING so nothing heavy going. If you needed to do this on a monster database you might need to use SQL Servers xml passing instead.
SELECT DISTINCT i.ID AS ItemID, i.Name AS ItemName, FieldItem.Name AS FieldName, f.Value AS FieldValue,
TemplateItem.ID AS TemplateID, TemplateItem.Name AS TemplateName,
SUBSTRING(f.Value, CHARINDEX('owner="', f.Value) + 7, CHARINDEX('"', SUBSTRING(f.Value, CHARINDEX('owner="', f.Value) + 7, LEN(f.Value) - CHARINDEX('owner="', f.Value) + 7)) - 1) AS LockUsername,
SUBSTRING(f.Value, CHARINDEX('date="', f.Value) + 7, CHARINDEX('"', SUBSTRING(f.Value, CHARINDEX('date="', f.Value) + 7, LEN(f.Value) - CHARINDEX('date="', f.Value) + 7)) - 1) AS LockDate
FROM dbo.Items i
INNER JOIN dbo.Fields f ON i.ID = f.ItemId
INNER JOIN dbo.Items FieldItem ON FieldItem.ID = f.FieldId
INNER JOIN dbo.Items TemplateItem ON TemplateItem.ID = i.TemplateID
WHERE FieldItem.Name = '__Lock'
To create a quick aggregate of the total locks by username simply do this.
SELECT LockUsername, COUNT(*) AS TotalLocks
FROM
(
SELECT DISTINCT i.ID AS ItemID, i.Name AS ItemName, FieldItem.Name AS FieldName, f.Value AS FieldValue,
TemplateItem.ID AS TemplateID, TemplateItem.Name AS TemplateName,
SUBSTRING(f.Value, CHARINDEX('owner="', f.Value) + 7, CHARINDEX('"', SUBSTRING(f.Value, CHARINDEX('owner="', f.Value) + 7, LEN(f.Value) - CHARINDEX('owner="', f.Value) + 7)) - 1) AS LockUsername,
SUBSTRING(f.Value, CHARINDEX('date="', f.Value) + 7, CHARINDEX('"', SUBSTRING(f.Value, CHARINDEX('date="', f.Value) + 7, LEN(f.Value) - CHARINDEX('date="', f.Value) + 7)) - 1) AS LockDate
FROM dbo.Items i
INNER JOIN dbo.Fields f ON i.ID = f.ItemId
INNER JOIN dbo.Items FieldItem ON FieldItem.ID = f.FieldId
INNER JOIN dbo.Items TemplateItem ON TemplateItem.ID = i.TemplateID
WHERE FieldItem.Name = '__Lock'
) data
GROUP BY LockUsername
I hope this is helpful to someone and prevents them having to write the whole thing from scratch.
want to speak to one of our experts?

Richard Brisley
In 2016 and again in 2019 Richard was recognise in the BIMA 100 awards for his outstanding work in Tech, his passion for digital and his contribution to the industry.