Tag: syndicated

  • Row-Level Security Basics–#SQLNewBlogger

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    I realized recently that I hadn’t really blogged about Row-Level Security, so this post covers some of the things I know at a high level.

    What is Row-Level Security?

    This was a feature added to SQL Server in SQL Server 2016 that makes it easy to grant access to rows of data based on some characteristic of a user. At a high level, this means:

    • I have something that segregates rows of data, like a CustomerID as a column in an Orders table.
    • I want a customer to only be able to view their orders, those associated with their customer ID.
    • This has to work, even if they didn’t use a WHERE clause and did a SELECT *.
    • In this case, a user for CustomerID 4 would only see Orders that had CustomerID=4 in those rows.

    We used to be able to do this with views, but this was cumbersome, and it was obfuscation. There was no security mechanism that actually ensured a user logged in wouldn’t see other rows.

    Row-Level Security

    This was a first class security mechanism that uses security policies and functions to control access. The way this works is as follows.

    We create a function that is a table-valued function which takes a parameter(s) from a column(s) and returns a 1 if the user should view a row. In this case, we would use a WHERE clause in the query in the function that looks for Orders.CustomerID = @CustomerID.

    We bind this function in a security policy that binds the function to the table, and specifies the column (or columns) used as parameters to the function. We also specify the predicate involved. There are two types:

    • Filter predicates – limit read access
    • Blog predicates – limit write (insert/update/delete) access

    We give permissions to the function to users.

    Does it Work?

    Yes. It works very well from a security standpoint. Since we are tying this to users or logins, the performance of determining if the user or login has access can be slow. The IS_ROLEMEMBER() and similar functions are not super efficient and you can have performance issues across millions of rows.

    However, it works.

    I’ll write more in the future on the details.

    SQL New Blogger

    I was watching a presentation recently on this topic. I’ve written about this for SQL Server Central, but when I checked, I hadn’t really done much blogging on it.

    Here I’m re-using knowledge, but in a basic way. I took 15 minutes to write a high level description. I’ll do a few more posts that demo setting this up for reads, one for writes, maybe one to get around how this might have a hole for security purposes. At least 3 more posts.

    You could learn this and blog 3-4 times about what you learn and how to set up it up situations.

  • Daily Coping 8 Nov 2021

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

    Today’s tip is to make a list of new things you want to do before the year ends.

    What do I want to do?

    • First, get the grass cut. I got some more done this weekend, but need to get out there for about 10 more hours.
    • Finishing learning Tears in Heaven on guitar. I got partway through and moved on to a few other things, but I want to finish this one.
    • More guitar. I’ve got a lot of partial songs, but I realize I need to pick one and focus for a week or two and then move on. I’d like to aim for 4 completions by Dec 31
    • Go snowboarding. I want to do this. It’s not a goal, but I’m hoping the snow looks good enough.
    • See a live movie – I miss doing this with my wife
    • Get some auto maintenance done. No, not the Tesla, the other things with oil here.
    • Convince a few people to plan a 2022 SQL Saturday – definitely on my mind more after Orlando
    • Go eat sushi – live
    • Have lunch with a few friends. I’ve neglected this lately with a busy schedule.

    There are certainly things I need to do, and plenty of chores, but these are more items I’d like to work on for myself.

  • Daily Coping 5 Nov 2021

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

    Today’s tip is to take time to reflect on what you accomplished this week.

    I’m writing about last week because if I delay this until Friday morning, or Thur afternoon, I’ll forget to do it. So, Oct 25-Oct 31.

    It was a busy week. Really the last stressful week with a bunch of deadlines for the next month, at least, I hope that’s the case. Here’s a list of things that happened last week:

    • Record a presentation
    • Review another presentation that was recorded in a group with comments for the editor
    • Schedule a bunch of social media stuff
    • Deliver a sales presentation on our products
    • Organize a few things I want to read through for learning (the actual learning is for next week)
    • Rehearse a presentation
    • Deliver a live presentation (SQL Saturday Orlando 2021)
    • Get on a plane, have a few dinners and breakfast with friends, and fly home. Actually got some work done on a plane.
    • Write (or really, finish) 5 editorials.
    • Watch a marketing presentation and give feedback (I didn’t expect this to be interesting)
    • Renewed my driver’s license
    • Watched a few kids I coached last year at their last high school game
    • Hold a first practice with kids starting their new season with me
    • Get to yoga 3 times, lift twice, ride the elliptical once and walk once
    • Cook 5 dinners for the family
    • Cut some grass, and cut down a tree that I’ve been meaning to clear all summer
    • Learn part of a new song on guitar

    I know I did more little stuff, but this came to mind.

  • Daily Coping 4 Nov 2021

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

    Today’s tip is to sign up for a new course, activity, or community.

    Not everything is work, and I am a member of plenty of work related things. I actually started looking at a new course for some work tasks.

    However, I also want to engage in other ways throughout the rest of my life. This wasn’t today, but I signed up with a coaching group a few months back. It was a chance to grow my knowledge, skills, and thoughts about how I interact with kids and work with them.

    As with a lot of groups, it’s been up and down. Lots of whining from people, and lots of complaints about things. Plenty of irrelevant chats, from my perspective. I don’t work with high school, so those aren’t applicable to me.

    However, I’ve gone from a lurker, trying to learn from others, to a participant, offering my thoughts or observations from my experience. While it hasn’t been that long for me, I have been coaching for about 6 years in this way, so I’ve learned a few things.

    It’s been an interesting addition to my life. I don’t spend a lot of time there, and not very regularly, but I am glad I made the effort.