One of my customers recently wanted to rename each of the SQL audit files will the datetime stamp of when it was created. I explained to them the filename already contains a datetime stamp. While it does not look like a typical timestamp, it is based on the Windows Filetime data structure that is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC). Nonetheless, they still wanted a traditional datetime stamp in the file name. According to the documentation, the audit file naming convention is this: and if we use this file as an example:...
Continue reading...TSQL Code
Create a Whitelist for SQL Server – UPDATED!!!
A while back, I posted an article about creating a WhiteList for access to SQL Server. Since then I have received a bit of feedback that it was not working as designed. My apologies for taking so long, but I believe I have come up with a fix. The main issue is the trigger will block some or even all access to the server after it’s created. As it turns out, the issues were really permission being denied. To see it in action, let’s create everything using the original code from here. We’ll add 1 row to the WhiteList table...
Continue reading...Create a Whitelist for SQL Server
UPDATED – May 16, 2017 – Please review the updated code here. In my previous post, Configuring the Azure SQL Database Firewall, I discussed how you can configure the firewall rules to manage access to the SQL Server. Today, I wanted to demonstrate how you can accomplish the same thing with your on-premise SQL Servers by creating a whitelist. So let’s start off by defining “whitelist”. According to the American Heritage Dictionary, it is “a list of people or organizations that have been approved to receive special considerations”. In our example, that “special consideration” is access to the SQL Server only if...
Continue reading...How Long is that SQL Command Going to Take?
Have you ever needed to restore a large database while someone is standing over your shoulder asking “How long is that going to take”? If that hasn’t happened to you yet, then it’s only a matter of time. Let’s throw out all the reasons why you need to do the restore and just discuss the technical part. Obviously the easiest way to know how long the restore will take is to use the “WITH STATS” option in the restore database command. But let’s say in the heat of the moment you forgot that little piece of the statement. Now what?...
Continue reading...In-Memory OLTP and the Identity Column
Over the past month I’ve been playing around with the new In-Memory OLTP (code name: “Hekaton”) features within SQL Server 2014 CTP2. My organization is all about low latency applications, and this is one feature of SQL Server that I need to get familiar with ASAP. To do this, I started my own little project that takes an existing database and converts parts of it into in-memory tables. Once that step is complete, I could work on rewriting the TSQL code. It might seem fairly simple, but with every new feature of SQL Server there are usually limitations. And one...
Continue reading...