Thursday, June 9, 2011

Query to get non-relative navigation links in a wss 3.0 database

Quick Description:  If non-relative  links are hard-coded in SharePoint navigation, problems will occur if the site is moved (for instance in a migration to the new version).  It is hard to identify and locate those links before they are found when they break.

One Solution:

The query below finds non-relative links embedded in the Quick Launch and Top Bar on WSS 3.0 sites.

Ideally this should be run on a non-production system with a restored copy of the content database, it's very bad behavior to query the live SharePoint database directly.  Replace topsite% with the name of the site under which you want to search.

use [ContentDBofSiteInQuestion]
go

select dbo.webs.title as SiteName, dbo.navnodes.url as NonRelativeURL, dbo.webs.fullurl as location
from dbo.navnodes
join dbo.webs on dbo.navnodes.webid = dbo.webs.id
where dbo.webs.fullurl like '/topsite%'
and dbo.navnodes.url like '%http%'

No comments:

Post a Comment