Shop Talk: 2022-10-24

The Recording

The Panelists

  • Kevin Feasel
  • Mala Mahadevan
  • Mike Chrestensen

Notes: Questions and Topics

Upcoming TriPASS Elections

We have three seats on the TriPASS board up for election this November: President (me), VP of Marketing (Rick Pack), and Treasurer (Mala). Nominations are open, so if you are a TriPASS member on the Meetup, reach out to me if you are interested in running for one of the board seats. Rick, Mala, and I are running but if you want to throw your hat into the ring, you are welcome to do so.

Voting will start on the 3rd Thursday in November and run through the first Thursday in December. Terms will begin in February of 2023 and run for 2 years.

TriPASS Survey

If you are an active TriPASS member, please fillĀ out our semi-annual survey. It will be open for a few more weeks and this helps shape the next two years for the organization.

SQL Saturday Richmond Recap

The first thing we talked about was a quick recap of SQL Saturday Richmond, the first SQL Saturday event in driving distance since 2020. It was a good time, though probably about 40% or so of normal turnout. Still, it was nice to see some regional folks at the event.

Keeping Up to Date with T-SQL

One of the themes from the Richmond recap was around keeping up to date with T-SQL. This started with a discussion of STRING_AGG() but I extended to include a variety of functions and functionality that have been introduced since SQL Server 2012 with the express intention of making life easier for people maintaining existing code. My quick survey is as follows:

SQL Server 2012

  • Updated window functions
  • CONCAT()
  • THROW()
  • TRY_CAST() and TRY_CONVERT(). Also TRY_PARSE() though that’s a lot slower.

SQL Server 2016

  • CREATE OR ALTER
  • DROP IF EXISTS
  • TRUNCATE TABLE WITH(PARTITIONS)
  • STRING_SPLIT()
  • SESSION_CONTEXT (thanks to Solomon for bringing that one up)

SQL Server 2019

  • APPROX_COUNT_DISTINCT()

SQL Server 2022

  • GREATEST() / LEAST()
  • STRING_SPLIT() (again)
  • DATE_BUCKET() and DATE_TRUNC()
  • GENERATE_SERIES()
  • APPROX_PERCENTILE_CONT() and APPROX_PERCENTILE_DISC()
  • Defining a window for a window function

From the standpoint of maintaining legacy SQL, SQL Server 2022 is shaping up to be one of the best releases in a while.

fn_my_permissions()

Mike needed to sort out permissions for a user and I pointed to a blog post I had written a while back on fn_my_permissions(). This only works for the current user (or whoever you are currently impersonating if you’re a sysadmin) but is the single most comprehensive look at permissions in SQL Server.

Leave a Reply

Your email address will not be published. Required fields are marked *