-->
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.

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, 52 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, 775 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,350 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,625 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, 278 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, 1,963 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, 608 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,217 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, 996 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,754 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,115 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, 976 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, 503 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,093 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

2 comments, 1,533 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

2 comments, 1,640 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,752 reads

Posted in SQL Quantum Leap on 20 November 2017

Line-Continuation in T-SQL

Some (or maybe most?) languages and operating system command shells allow for breaking up long lines into multiple lines (i.e. lines separated by hitting Enter / Return). This is accomplished by ending a line with a particular character that indicates that the line is not ending. For operating system… Read more

1 comments, 3,411 reads

Posted in SQL Quantum Leap on 27 October 2017

All New Collations in SQL Server 2017 Implicitly Support Supplementary Characters

As I was testing whether or not the new “Variation Selector Sensitive” ( _VSS ) Collations in SQL Server 2017 would assist in the following question on DBA.StackExchange:

SELECT query: filter unable to distinguish between two different characters

I ran into what initially looked to be an unfortunate situation. I… Read more

1 comments, 1,391 reads

Posted in SQL Quantum Leap on 16 October 2017

SQLCLR vs. SQL Server 2017, Part 6: “Trusted Assemblies” – Whitelisted Assemblies can’t do Module Signing

“Trusted Assemblies”, a new feature starting in SQL Server 2017, is a means of whitelisting Assemblies that one feels pose no threat, and can be created (and used) without needing to be a) signed and b) have a corresponding signature-based Login that has been granted the UNSAFE ASSEMBLY permission. In… Read more

3 comments, 1,439 reads

Posted in SQL Quantum Leap on 29 September 2017

Older posts