THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | Join | Help
in Search

Peter DeBetta's SQL Programming Blog

Peter DeBetta's blog about programming in SQL Server 2008, 2005, etc. using technologies such as T-SQL, .NET, CLR, C#, VB, Visual Studio, and SQL Server Management Studio.

  • OT: Getting Fit in February

    A friend and colleague of mine, Caleb Jenkins, has started a fitness challenge (http://calebjenkins.wordpress.com/2009/01/29/official-rules/) and I decided that it was time for me to accelerate my fitness program that I had started in January. As of 9:00 AM on February 1, I weighed in at 201 pounds. My overall and ambitious goal is to lose at least 20 pounds. I hope to lose at least 10 pounds during the month of February. Even if I don’t win the fitness challenge, I will be much better off and will hopefully get to my ultimate goal of staying under 180 pounds.

    I worked out on Saturday and Sunday. On Sunday I also helped my 5 year old son attempt to ride his bicycle without training wheels for the first time. My backs hurts from leaning over and catching Chris from falling. I am sore. I am achy. But I am determined. Wish me luck on my road to a healthier lifestyle.


  • Tweet! SQLblog is now on Twitter!

    Are you a twitter tweeter who loves SQL Server? You are?! Great, because SQLblog is now posting (AKA tweeting) on Twitter at http://twitter.com/sqlblog. Enjoy!


  • Introducing SQL Server 2008 - The Book

    It took a while, but a new e-book authored by yours truly, Greg Low, and Mark Whitehorn is finally available. And it's free!

    To get your free copy, browse to http://www.microsoft.com/learning/sql/2008/default.mspx. From there, look in the Special Offers section for the "Free e-book offer". Although the site states you can get excerpts, the whole book is available for reading.

    Many, many thanks to Greg and Mark for their quality contributions to the book.


  • PSA: Juvenile Diabetes Research Foundation - Walk to Cure Diabetes

    Last year, my 4 year-old son and I walked (well, I carried him for 2 miles) in support of Juvenile Diabetes Research Foundation (JDRF). We raised a modest amount in support of this wonderful effort. This year, we want to help more than ever, and I thought I'd ask the SQLblog community for some additional support.

    We are walking in support of our friend Marissa (Marissa's Mermaids team). Marissa was diagnosed in Sept. 2005 with Type 1 Diabetes, since then she has had 4620 finger pricks to draw blood and 1095 injections. Now, she is attached to an insulin pump 24 hours a day. Type 1 (or Juvenile) Diabetes is a chronic, debilitating disease affecting every organ system - it is an autoimmune disease where the body attacks its pancreas and permanently destroys the cells that make insulin. Once Type 1 Diabetes arrives, it becomes a life-long condition.

    Like nearly 3 million Americans with Type 1 Diabetes, Marissa has lower projected lifespan by 14 years and is more likely to suffer blindness, amputation, heart disease, kidney disease, nerve damage, stroke, and heart attack. Every year, 13,000 children are diagnosed. INSULIN IS NOT A CURE - IT IS MERELY LIFE SUPPORT. At times when Marissa is most upset, with tears in her eyes, she says, "I wish I could take my diabetes and throw it in the trash can."

    To manage Marissa's diabetes, her parents have the impossible struggle of balancing carbohydrates, insulin, and physical activity with uncontrollable variables such as illness, growth, exercise-level, excitement, and stress. Every day offers Marissa the risk of a drastic low blood sugar causing seizure or possibly death. It could only take one mistake on one morning or one afternoon or one night. Or it could simply involve a random event from her body.

    Marissa is brave. Her parents poke her finger to draw blood 8-12 times each day including routine checks at midnight and 3am. Every carbohydrate at every meal or snack must be counted. The carbs must be perfectly balanced immediately through injections or an insulin pump to attempt to imitate the way yours and my pancreas works. There are no exceptions and there is never a day off!

    JDRF is amazingly efficient - 85% of donations go directly to research.

    Major research advances have occurred in the past few years! Diabetes has been cured in mice in at least 4 ways and various human trials are beginning. Scientists legitimately believe a cure is possible before Marissa loses this life-long battle. We ask you to share Marissa's story with your organization so that your entire company would consider sponsoring Marissa. Your contribution might make the difference in the one research laboratory where the cure will be achieved!

    So if you are able to donate, please visit http://walk.jdrf.org/index.cfm?fuseaction=extranet.personalpage&confirmid=87065878. Together we can help find a cure!


  • Policy Based Management Evaluation Modes

    Dan Jones wrote a great post about Facets from the new Policy-Based Management feature of SQL Server 2008. At one point in the post, he listed all of the available facets and their supported evaluation modes. Since SQL Server 2008 is not RTM, and since facets can be added in the future, I thought I'd write a query that would list the facets and supported evaluation modes.

    Note that the On Demand mode is always supported and has therefore been left out of the query.

    ;WITH EM (EvalModeID, EvalModeName)
    AS
    SELECT *
       FROM
           (VALUES 
               (1, 'Check on Change: Prevent'),
               (2, 'Check on Change: Log'),
               (4, 'Check on Schedule')) AS EvalModes (EvalModeID, EvalModeName)
    )
    , FEM (FacetID, FacetName, EvaluationMode, IsSupported)
    AS
    SELECT
           pmf.management_facet_id
           , pmf.name
           , EM.EvalModeName
           ,
       FROM msdb.dbo.syspolicy_management_facets AS pmf
           INNER JOIN EM ON pmf.execution_mode & EM.EvalModeID = EM.EvalModeID
    )
    SELECT FacetID
       , FacetName
       , [Check on Change: Prevent]
       , [Check on Change: Log]
       , [Check on Schedule]
    FROM FEM
    PIVOT 
    COUNT(IsSupported)
       FOR EvaluationMode IN ([Check on Change: Prevent], [Check on Change: Log], [Check on Schedule])
    )AS FEMP
    ORDER BY FacetName

    The results for the existing 72 facets are as follows:

    FacetID

    FacetName

    Check on Change: Prevent

    Check on Change: Log

    Check on Schedule

    1

    ApplicationRole

    1

    1

    1

    2

    AsymmetricKey

    1

    1

    1

    3

    Audit

    0

    0

    1

    4

    BackupDevice

    0

    0

    1

    5

    BrokerPriority

    0

    0

    1

    6

    BrokerService

    0

    0

    1

    7

    Certificate

    0

    0

    1

    8

    Credential

    0

    0

    1

    9

    CryptographicProvider

    0

    0

    1

    10

    Database

    0

    0

    1

    11

    DatabaseAuditSpecification

    0

    0

    1

    12

    DatabaseDdlTrigger

    0

    0

    1

    13

    DatabaseRole

    1

    1

    1

    14

    DataFile

    0

    0

    1

    15

    Default

    0

    0

    1

    16

    Endpoint

    1

    1

    1

    17

    FileGroup

    0

    0

    1

    18

    FullTextCatalog

    0

    0

    1

    19

    FullTextIndex

    0

    0

    1

    20

    FullTextStopList

    0

    0

    1

    21

    IDatabaseMaintenanceFacet

    0

    0

    1

    22

    IDatabaseOptions

    0

    1

    1

    23

    IDatabasePerformanceFacet

    0