Tuesday, November 22, 2011

SharePoint 2010 migration

here is a query to find where in your site the Fab 40 templates are being use, this will help you locate and take some action.
The SP migration reports give you so much information but this query will go thru all the content and find where those template ID's have been use



create table #temporal(
[Title] nvarchar(max),
[WebTemplate] int,
[FullUrl] nvarchar(max),
[LastMetadataChange] datetime
);
exec sp_MSforeachdb 'USE [?] IF EXISTS(select 1 from [?].Information_Schema.Tables Where Table_Name = ''Webs'')
BEGIN
insert into #temporal(Title, WebTemplate, FullUrl, LastMetadataChange)(
SELECT Title, WebTemplate, FullUrl, LastMetadataChange
FROM Webs
WHERE (WebTemplate LIKE ''7%'' or WebTemplate = ''10002'')

);
END
'
select * from #temporal order by FullUrl
drop table #temporal