Friday, April 26, 2013

TSQL query to find webparts in SharePoint content databases


select d.DirName + ‘/’ + d.LeafName as [URL]
,w.tp_ID as [GUID for WebPart]
,w.tp_ZoneID as [WebPart Zone]
,tp_WebPartTypeID as [Web Part Type ID]
,tp_DisplayName
,tp_ContentTypeId
from SharePoint_Content_01.dbo.AllDocs d WITH(NOLOCK)
join SharePoint_Content_01.dbo.WebParts w WITH(NOLOCK)
on w.tp_PageUrlID = d.Id and w.tp_SiteId = d.SiteId
where d.IsCurrentVersion = 1
and DirName like ‘%Acquisition%’
and LeafName like ‘%default.aspx’
union
select d.DirName + ‘/’ + d.LeafName as [URL]
,w.tp_ID as [GUID for WebPart]
,w.tp_ZoneID as [WebPart Zone]
,tp_WebPartTypeID as [Web Part Type ID]
,tp_DisplayName
,tp_ContentTypeId
from SharePoint_Content_02.dbo.AllDocs d WITH(NOLOCK)
join SharePoint_Content_02.dbo.WebParts w WITH(NOLOCK)
on w.tp_PageUrlID = d.Id and w.tp_SiteId = d.SiteId
where d.IsCurrentVersion = 1
and DirName like ‘%Acquisition%’
and LeafName like ‘%default.aspx’

How to find Primary Key and Foreign Key relationship using T-SQL


USE AdventureWorks;
GO
SELECT f.name AS ForeignKey,
SCHEMA_NAME(f.SCHEMA_ID) SchemaName,
OBJECT_NAME(f.parent_object_id) AS TableName,
COL_NAME(fc.parent_object_id,fc.parent_column_id) AS ColumnName,
SCHEMA_NAME(o.SCHEMA_ID) ReferenceSchemaName,
OBJECT_NAME (f.referenced_object_id) AS ReferenceTableName,
COL_NAME(fc.referenced_object_id,fc.referenced_column_id) AS ReferenceColumnName
FROM sys.foreign_keys AS f
INNER JOIN sys.foreign_key_columns AS fc ON f.OBJECT_ID = fc.constraint_object_id
INNER JOIN sys.objects AS o ON o.OBJECT_ID = fc.referenced_object_id
GO

SharePoint 2010 Branding using sand boxed solutions

Used this guide from Microsoft to tailor a custom branding solution for several farms for my customer.

http://msdn.microsoft.com/en-us/library/gg447066.aspx

Where is my MS certification Number/What is it anyway?

Going through the standard provide me your crenditials routine with my company and
could not remember where microsoft parks that info.  So here it is

http://www.microsoft.com/learning/members/en/us/mcp/mcp-default.aspx

Wednesday, April 24, 2013

Tranform web.config on publish

Needed to brush up on the difference between Replace and Set attribute.  This MS posting did the trick for me.

http://msdn.microsoft.com/en-us/library/dd465326.aspx

Tuesday, April 23, 2013

How to add SQL Profiler to an existing SQL 2008 R2 install

Went lookup for some help to solve this problem.  We had a VM which had did not include the SQL profiler tool!  Did not know it until I went to fire up this tool and it was not there under the tools menu. 

This thread put me onto the solution.

http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/4808224c-1adb-4e43-8ae8-c45aba48abb1

Here is the short solution to the problem.

Open cmd.exe.  On some machines due to local policies you may need to run this session as administrator.

setup.exe /FEATURES=Tools /Q /INDICATEPROGRESS /ACTION=Install /INSTANCENAME=
YOURMACHINENAME\YOURINSTANCE /BROWSERSVCSTARTUPTYPE=Automatic /AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /IACCEPTSQLSERVERLICENSETERMS

This takes a bit of time to run but don't fret just let it run.  It will finish.