-->
SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

SQL Quantum Leap

Solomon Rutzky has been working with computers since the mid 1980s. He has experience with a variety of hardware platforms, OSs, programming languages, and RDBMSs. He has focused on SQL Server since 2002, and has written articles for SQL Server Central, including the Stairway to SQLCLR series, and Simple Talk. Solomon is the founder / owner of Sql Quantum Lift, and is the creator of the popular SQL# SQLCLR library. He answers questions on a few StackExchange sites and Ask.SqlServerCentral.com.

SQLCLR vs SQL Server 2017, Part 8: Is SQLCLR Deprecated in Favor of Python or R (sp_execute_external_script)?

With the additional (and annoying) configuration step required to get SQLCLR Assemblies to load starting in SQL Server 2017, some people have been wondering what is going on with SQLCLR. Considering that this new restriction is the only real change to SQLCLR since SQL Server 2012 (three versions ago), then… Read more

2 comments, 179 reads

Posted in SQL Quantum Leap on 9 August 2018

Changing the Collation of the Instance, the Databases, and All Columns in All User Databases: What Could Possibly Go Wrong?

Demystifying What “sqlservr -q” Actually Does

(last updated on 2018-08-02)

For various reasons, people sometimes find themselves in the unfortunate (and unenviable) situation of having an Instance of SQL Server configured with the wrong Collation. This can often lead to unexpected errors and/or sorting and comparison behavior.

People sometimes try… Read more

7 comments, 2,539 reads

Posted in SQL Quantum Leap on 12 June 2018

Enable Group Policy Editor (gpedit.msc) on Windows 10 Home Edition

Occassionally I want / need to change a Windows setting that is not configurable via Control Panel or Settings. For example:

The instructions usually require using Group Policy Editor (gpedit.msc). Unfortunately, I am using Microsoft Windows 10… Read more

3 comments, 562 reads

Posted in SQL Quantum Leap on 6 June 2018

The Uni-Code: The Search for the True List of Valid Characters for T-SQL Identifiers, Part 3 of 2 (Delimited Identifiers)


(last updated: 2018-04-26)

This is Part 3 of 2. Yes, you read that correctly. You see, way back at the very beginning (i.e. in Part 1), I mentioned:

…based on my experiences, it seems that more often than not, doing an exhaustive test results in a slightly different answer…

Read more

1 comments, 116 reads

Posted in SQL Quantum Leap on 16 April 2018

Why Doesn’t CONTEXT_INFO() Return the Exact Value Set by SET CONTEXT_INFO?

(last updated: 2018-04-28)

Let’s say that you execute the following T-SQL:

SET CONTEXT_INFO 1234;
SELECT CONVERT(INT, CONTEXT_INFO());

The result will be:

0

Why is that? The value passed in is an INT, which is only 4 bytes, yet CONTEXT_INFO can hold up to 128 bytes. Certainly 4 can fit… Read more

1 comments, 871 reads

Posted in SQL Quantum Leap on 9 April 2018

What’s in a Name?: Inside the Wacky World of T-SQL Identifiers


(last updated: 2018-04-28)

Today we are going to take a look into an area that you probably are thinking has very little to see: T-SQL Identifiers (i.e. entity names). Most of the time the rules governing how you name things in SQL Server are pretty simple, but there are several… Read more

1 comments, 2,538 reads

Posted in SQL Quantum Leap on 9 April 2018

The Uni-Code: The Search for the True List of Valid Characters for T-SQL Regular Identifiers, Part 2


(last updated: 2018-04-28)

Recap

In Part 1 of this 2 part series, I started with the loose definition in Microsoft’s documentation for “Database Identifiers“, which states (slightly edited for readability):

Rules for Regular Identifiers

  1. The first character must be one of the following:

    • A letter as defined by…

Read more

3 comments, 1,725 reads

Posted in SQL Quantum Leap on 6 April 2018

The Uni-Code: The Search for the True List of Valid Characters for T-SQL Regular Identifiers, Part 1


(last updated: 2018-04-09)

In answering a recent question on DBA.StackExchange related to why some characters work for parameter names and others do not ( How to create Unicode stored procedure parameter names ), I pointed out that the documentation for Database Identifiers states (slightly edited for readability):

Rules for Regular…

Read more

4 comments, 361 reads

Posted in SQL Quantum Leap on 3 April 2018

Safely and Easily Use High-Level Permissions Without Granting Them to Anyone: Database-level

Part of having good security is giving users the fewest / least permissions possible in order to execute the code. However, we always seem to find ourselves needing to allow someone to execute something that requires one or two higher-level permissions. Yet, in order to allow for just one extra… Read more

1 comments, 2,080 reads

Posted in SQL Quantum Leap on 5 March 2018

SQLCLR vs. SQL Server 2012 & 2014 & 2016, Part 7: “CLR strict security” – The Problem Continues … in the Past (Wait, What?!?)

If the new “CLR strict security” Server-level configuration option in SQL Server 2017 hasn’t caused enough confusion and pain, then, as Eagle Man says, “I’ve got something for you”. You can now enable this super-fun setting in SQL Server 2012, 2014, and 2016. Why would anyone (intentionally) do this?… Read more

0 comments, 747 reads

Posted in SQL Quantum Leap on 23 February 2018

Safely and Easily Use High-Level Permissions Without Granting Them to Anyone: Server-level

Part of having good security is giving users the fewest / least permissions possible in order to execute the code. However, we always seem to find ourselves needing to allow someone to execute something that requires one or two higher-level permissions. Yet, in order to allow for just one extra… Read more

6 comments, 2,362 reads

Posted in SQL Quantum Leap on 15 February 2018

SQL# Version 4.1 is released!!

Version 4.1 of SQL# has just been released!

New functionality available only in Full version

  1. Sys_LockResource
    • Returns the name of the specified Lock Resource given the Type, Subtype, DatabaseID, Description, and AssociatedEntityID.
    • Works similarly to the OBJECT_NAME and OBJECT_SCHEMA_NAME built-in functions in that you do…

Read more

1 comments, 1,112 reads

Posted in SQL Quantum Leap on 12 February 2018

Server Audit Mystery 2: Filtering action_id gets Error Msg 25713

This post is, for the most part, a continuation of Server Audit Mystery 1: Filtering class_type gets Error Msg 25713. In that post I was trying to filter on the class_type field / predicate source (i.e. the object, or whatever, that the event is on). The tricky part was… Read more

0 comments, 1,903 reads

Posted in SQL Quantum Leap on 30 January 2018

Will GDPR cause a “Database Run”?

What is GDPR, everyone’s (current) favorite acronym? It stands for “General Data Protection Regulation” and is an act / law / set of laws that governs the collection, retention, and use of personal information for EU (European Union) and UK citizens. It’s the topic “flavor of the month” due to… Read more

0 comments, 2,238 reads

Posted in SQL Quantum Leap on 23 January 2018

Server Audit Mystery 1: Filtering class_type gets Error Msg 25713

The other day I ran into an odd problem trying to answer the following question on DBA.StackExchange:

How to filter out Scalar Valued Function usage from SQL Server Audit Data?

According to the documentation for CREATE SERVER AUDIT, I should be able to add a WHERE clause (starting in… Read more

2 comments, 1,118 reads

Posted in SQL Quantum Leap on 22 January 2018

Stored Procedure / Function / View / Trigger Definitions Can Be Wrong, Even If sp_rename Was Never Used

SQL Server stores the full definition of certain T-SQL objects — Stored Procedures, Functions, Views, and Triggers — in their original form, as they are being created. In fact, the entire batch containing the CREATE statement is stored, which is quite likely why no other statements are allowed in a… Read more

2 comments, 584 reads

Posted in SQL Quantum Leap on 9 January 2018

PLEASE, Please, please Stop Using Impersonation, TRUSTWORTHY, and Cross-DB Ownership Chaining

(last updated: 2018-03-27)

Despite features added in SQL Server 2005 (yes, 2005!) that allow for very flexible, granular, and robust security, it is still quite common for people to be using the older and/or riskier mechanisms of temporarily granting additional privileges.

What follows is an overview of a presentation that… Read more

3 comments, 1,398 reads

Posted in SQL Quantum Leap on 30 December 2017

Which Collation is Used to Convert NVARCHAR to VARCHAR in a WHERE Condition? (Part B of 2: “Rabbit”)

(If you’re reading this on SQL Server Central, please click here to see the “Featured Image” which will help explain the “Duck” vs “Rabbit” titles of this and the previous posts)

Welcome back! Previously, on “Who’s Collation is it Anyway?”, due to statements made in the Microsoft documentation for… Read more

3 comments, 1,667 reads

Posted in SQL Quantum Leap on 11 December 2017

Which Collation is Used to Convert NVARCHAR to VARCHAR in a WHERE Condition? (Part A of 2: “Duck”)

(If you’re reading this on SQL Server Central, please click here to see the “Featured Image” which will help explain the “Duck” vs “Rabbit” titles of this and the next posts)

So, the actual question is a bit more specific than would reasonably fit into a title, and it is: Read more

3 comments, 1,910 reads

Posted in SQL Quantum Leap on 8 December 2017

Sessions, Temporary Objects, and the Afterlife

For thousands of years theologians have offered various thoughts on the question of what happens when we die. Does some part of who we are come back to start over again? Do we go to some other place? Is “the end” simply that: the end, in an absolute sense? When… Read more

1 comments, 1,862 reads

Posted in SQL Quantum Leap on 20 November 2017

Older posts