Author: way0utwest

  • Getting Your SET Options

    Have you ever used @@options? I haven’t typically needed this, but there are times that you might wonder what options are set for a session. You can check in SSMS, look for defaults, etc., but there’s an easy way.

    SELECT @@OPTIONS

    This uses the @@options function, which contains a bitmap of your session settings. There are defaults with the sp_configure user options, but these can be overridden.

    If you want to get the options, which are also stored as bitmaps in various places, you can code them with this BOL article.

    Or use a script like this:

    DECLARE @i INT;
    SELECT @i = @@OPTIONS;
    SELECT ConstraintChecking = CASE WHEN (@i & 1 = 1 ) THEN 'ON' ELSE 'OFF' end,
            ImplicitTransactions = CASE WHEN (@i & 2 = 2 ) THEN 'ON' ELSE 'OFF' end,
            CursorCloseonCommit = CASE WHEN (@i & 4 = 2 ) THEN 'ON' ELSE 'OFF' end,
            AnsiWarnings = CASE WHEN (@i & 8 = 8 ) THEN 'ON' ELSE 'OFF' end,
            AnsiPadding = CASE WHEN (@i & 16 = 16 ) THEN 'ON' ELSE 'OFF' end,
            AnsiNulls = CASE WHEN (@i & 32 = 32 ) THEN 'ON' ELSE 'OFF' end,
            ArithAbortSetting = CASE WHEN (@i & 64 = 64 ) THEN 'ON' ELSE 'OFF' end,
            ArithIgnoreSetting = CASE WHEN (@i & 128 = 128 ) THEN 'ON' ELSE 'OFF' end,
            QuotedIdentifer = CASE WHEN (@i & 256 = 256 ) THEN 'ON' ELSE 'OFF' end,
            NoCount = CASE WHEN (@i & 512 = 512 ) THEN 'ON' ELSE 'OFF' end,
            AnsiNullDefaultOn = CASE WHEN (@i & 1024 = 1024 ) THEN 'ON' ELSE 'OFF' end,
            AnsiNullDefaultOff = CASE WHEN (@i & 2048 = 2048 ) THEN 'ON' ELSE 'OFF' end,
            ConcatNullYieldsNull = CASE WHEN (@i & 4096 = 4096 ) THEN 'ON' ELSE 'OFF' end,
            NumericRoundAbort = CASE WHEN (@i & 8192 = 8192 ) THEN 'ON' ELSE 'OFF' end,
            XactAbort = CASE WHEN (@i & 16384 = 16384 ) THEN 'ON' ELSE 'OFF' END

    For the row-based people, how about this:

    DECLARE @i INT;
    SELECT @i = @@OPTIONS;
    SELECT 'ConstraintChecking', CASE WHEN (@i & 1 = 1 ) THEN 'ON' ELSE 'OFF' END
    UNION 
    SELECT  'ImplicitTransactions', CASE WHEN (@i & 2 = 2 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'CursorCloseonCommit', CASE WHEN (@i & 4 = 4 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'AnsiWarnings', CASE WHEN (@i & 8 = 8 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'AnsiPadding', CASE WHEN (@i & 16 = 16 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'AnsiNulls', CASE WHEN (@i & 32 = 32 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'ArithAbortSetting', CASE WHEN (@i & 64 = 64 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'ArithIgnoreSetting', CASE WHEN (@i & 128 = 128 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'QuotedIdentifer', CASE WHEN (@i & 256 = 256 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'NoCount', CASE WHEN (@i & 512 = 512 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'AnsiNullDefaultOn', CASE WHEN (@i & 1024 = 1024 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'AnsiNullDefaultOff', CASE WHEN (@i & 2048 = 2048 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'ConcatNullYieldsNull', CASE WHEN (@i & 4096 = 4096 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'NumericRoundAbort', CASE WHEN (@i & 8192 = 8192 ) THEN 'ON' ELSE 'OFF' end
    UNION 
    SELECT  'XactAbort', CASE WHEN (@i & 16384 = 16384 ) THEN 'ON' ELSE 'OFF' END

    UPDATE: From the comments, an UNPIVOT might be easier to read for some of you.

    DECLARE @i INT;
    SELECT @i = @@OPTIONS;
    SELECT [Option], [Value]
    FROM(
    SELECT ConstraintChecking = CASE WHEN (@i & 1 = 1 ) THEN ‘ON’ ELSE ‘OFF’ end,
    ImplicitTransactions = CASE WHEN (@i & 2 = 2 ) THEN ‘ON’ ELSE ‘OFF’ end,
    CursorCloseonCommit = CASE WHEN (@i & 4 = 2 ) THEN ‘ON’ ELSE ‘OFF’ end,
    AnsiWarnings = CASE WHEN (@i & 8 = 8 ) THEN ‘ON’ ELSE ‘OFF’ end,
    AnsiPadding = CASE WHEN (@i & 16 = 16 ) THEN ‘ON’ ELSE ‘OFF’ end,
    AnsiNulls = CASE WHEN (@i & 32 = 32 ) THEN ‘ON’ ELSE ‘OFF’ end,
    ArithAbortSetting = CASE WHEN (@i & 64 = 64 ) THEN ‘ON’ ELSE ‘OFF’ end,
    ArithIgnoreSetting = CASE WHEN (@i & 128 = 128 ) THEN ‘ON’ ELSE ‘OFF’ end,
    QuotedIdentifer = CASE WHEN (@i & 256 = 256 ) THEN ‘ON’ ELSE ‘OFF’ end,
    NoCount = CASE WHEN (@i & 512 = 512 ) THEN ‘ON’ ELSE ‘OFF’ end,
    AnsiNullDefaultOn = CASE WHEN (@i & 1024 = 1024 ) THEN ‘ON’ ELSE ‘OFF’ end,
    AnsiNullDefaultOff = CASE WHEN (@i & 2048 = 2048 ) THEN ‘ON’ ELSE ‘OFF’ end,
    ConcatNullYieldsNull = CASE WHEN (@i & 4096 = 4096 ) THEN ‘ON’ ELSE ‘OFF’ end,
    NumericRoundAbort = CASE WHEN (@i & 8192 = 8192 ) THEN ‘ON’ ELSE ‘OFF’ end,
    XactAbort = CASE WHEN (@i & 16384 = 16384 ) THEN ‘ON’ ELSE ‘OFF’ END) AS options
    UNPIVOT (
    [Value] FOR [OPTION] IN ([ConstraintChecking],[ImplicitTransactions],[CursorCloseonCommit],[AnsiWarnings],[AnsiPadding],[AnsiNulls],[ArithAbortSetting],[ArithIgnoreSetting],[QuotedIdentifer],[NoCount],[AnsiNullDefaultOn],[AnsiNullDefaultOff],[ConcatNullYieldsNull],[NumericRoundAbort],[XactAbort])
    ) AS T1
    ORDER BY [Option]
    GO
  • Influence the Program

    When I first started going to the PASS Summit, I was enthralled with the speakers, no matter what the topic. Meeting Kalen Delaney at the first Summit was a milestone in my career. In those early years, there weren’t many speakers, and they submitted the talks they were interested in giving. The program committee made their decisions, and many of us went to watch whatever was available. The surface area of SQL Server was much smaller, so we could probably guess many of the topics, and that worked out well.

    As SQL Server has grown, some of us have questioned the makeup of the sessions over time. At one point it seemed we were very light on BI, almost as if the conference hadn’t kept pace with the changes in the platform. It seemed that the next conference was based on ratings and attendance from the previous Summit, but that’s a slowly changing way to pick talks.

    Things changed, and for a number of years PASS has been trying to understand what content you’d like to see. There have been surveys and polls to understand not only what worked last year, but what changes should happen this year. Last year’s tracks were set not by technology, but by the Analyze/Build/Design/etc. monikers. I’m not sure I loved that, but it was a worthy experiment.

    There’s a survey open from PASS from now until Feb 14, trying to understand what you’d like to see. Once again, they are asking what you’d like to see. I’d encourage all of you to fill it out, as you can truly influence the balance of sessions that will be presented. Do you want more ML/AI/bots, and other advanced topics? Do you need more beginning content for your junior DBAs? Is the core engine still important for you, or are you looking for SSIS, SSRS, or other content. Power BI on your radar?

    Speakers often have preferences, and I see no shortage of conferences that just pick talks from what they get. This can make a disjointed event at times. I like the idea of having submissions in areas that I might not consider as an organizer, but I also think that inviting speakers to talk on specific topics is good. I’m glad PASS does a mix of these things, inviting some speakers, asking for topics, and also taking community submissions. Many of us that present are happy to slightly tailor our talks if we know that’s what the audience wants.

    So take the survey, with a chance to win a Summit admission. Tell the committee if DevOps and testing are important (they are), or if you want to see more SSAS content (are there that many of you using this?). Even if you aren’t going, it’s useful for us as a community to learn what’s of interest to everyone. I’d also request that you ask PASS to release the data, which will help SQL Saturdays and other events better plan their schedules.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 5.1MB) podcast or subscribe to the feed at iTunes and Libsyn.

  • Learning Goals–January Review

    In December I participated in T-SQL Tuesday #97 and wrote a post about 2018 goals. I promptly spent two weeks out of the country and then a relaxing holiday season. Actually, holidays extended slightly with a ski trip and a wedding in January.

    This is a look back at my goals, since I have a monthly reminder to do so. This is the first review, a little late as I’ve struggled to focus a bit on work in January, but here goes.

    Progress

    I picked two things to work on this year: Python and Extended Events. I’m failing miserably in both.

    I did work on a little Python in solving a few of the Advent of Code puzzles, but I’ve only read a few pages in the Machine Learning book and not much else. I’ve gotten distracted by other items on my list.

    I haven’t done anything on Extended Events.

    I did play with a little more Pester, and I set up an MVC site in a project for a demo, so I tackled things that interest me, but not in the extra areas I wanted to learn.

    Planning and Moving Forward

    I didn’t actually do my planning in December. When the appointment came up, I was a little buried with other items and let it pass without rescheduling.

    Moving forward, here’s what I want to do. I’m going to set a reminder for Tuesday afternoons to spend an hour on XE. I’ll set that for 3 months and see where we stand. I’m hoping to work through a bit of Pluralsight courses and then some of Jason Brimhall’s series on his blog.

    For Python, I’m going to take some time on Friday mornings here. That’s likely a slower time for me, so I’m scheduling a half hour to work on something with Python. I need to refresh some core skills and then move on from there. I’ll likely go back through a bit of the Dive into Python book, then try moving to a bit of ML stuff. This is good as I’ll get some content, at least questions of the day, out of this work.

    I also realize that I continue to spend some time on R, as this is a part of SQL Server and it’s an area that generates some content for SSC. That along with my MVC project are things that will distract me a bit, but I’ll try to push forward in all these directions.

    Hopefully this will result in a better review next month.

  • Finding the Right Data

    For a couple years, Big Data was heavily hyped, and Hadoop became incredibly popular. In fact, so popular that Microsoft build HDInsight and Polybase to allow us to take advantage of these technologies and integrate them into our own systems. While the year has seen less hype on “big data” specifically, more and more of us are dealing with large amounts of data every day. There isn’t a good definition of Big Data I’ve seen, but whatever you thought it meant five years ago has surely changed to mean larger volumes today.

    One of the important things that many organizations are learning is that they don’t necessarily need more bits and bytes of all their data. They’re increasingly learning that they need more of the right data, which is the data that is useful to them. Often this is the data that lets them make decisions that improve their revenue, profits, efficiency, etc. As we move to GDPR this spring, it might also me more auditing data that prevents problems or satisfies regulators.

    I ran across an interesting article that talks about companies needing the right data, which can often mean unstructured data outside of their traditional OLTP databases when dealing with customers. The article focuses on NLP (natural language processing) and social media data, but it could just as easily mean audio/video data from customer calls (or emails) or even sensor data from systems that are managed and track the ability of customers to use your product or service.

    As the world of computing advances, many of us know that we need to find new and better ways to provide value to our employers. This might be with managing and gathering or tracking a wider variety of data, perhaps meaning that some of us need to keep some of those tweets or posts inside our systems. It could be that we need to provide new ways of analyzing data, maybe with some sort of ML (Machine Learning) or AI (Artificial Intelligence) processing. Perhaps it’s that we need to collate and collect detailed auditing information we can produce on demand to ensure our organization complies with legal requirements.

    Perhaps there’s some other way that our work as data profressionals will change, but I’m sure it will continue to change and evolve across the next decade. I’m also sure this means lots of new and different data opportunities for us, if we’re willing to grab them with the right data.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 3.9MB) podcast or subscribe to the feed at iTunes and Libsyn.