Wednesday, December 21, 2011

Reset Windows Media Player 12 To Default Settings

Here's a cool trick that allows you to reset WMP12 back to it’s default settings. This might be handy if you are encountering any issues of your own.
Simply to go Start > Run (or hold down the Windows Key and press R) and type in the following:
msdt.exe -id WindowsMediaPlayerConfigurationDiagnostic
Press enter and follow the prompts to reset WMP.

Thursday, December 8, 2011

SQL example for updating children records from a parent record

I just ran into this again, and I know I have had to do this several times before but it gets old having to look up such an activity that I may only do twice a year.

The scenario... There are four records:
ID=123, ParentID=null, Name="Bob"


ID=1000, ParentID=123, Name="Bob"
ID=1001, ParentID=123, Name="Bob"
ID=1002, ParentID=123, Name="Bob"

The requirement is to update Name="Joe" where ID=123, and then cascade the changes to the children records.  This could be done easily w/ the same proc that updates the parent, however in my situation that proc is being shared, so my solution is to make a new query that fetches the right info w/ a join and then updates:

UPDATE children
SET
Field1 = parent.Field1,
Field2 = parent.Field2,
Field3 = parent.Field3
from ExampleTable children
inner join ExampleTable parent on parent.ID = children.ParentID
WHERE children.ParentID = @ParentID