Categories
SQL Server

Ingesting Azure Blob Data Directly to SQL Server

We may associate consuming data from Azure Storage with tools like Data Factory or even SSIS as we saw recently. We don’t always need the middle man though. Here we’ll demonstrate how to use an External Data Source to perform the ingestion directly into SQL Server. Firstly we need the credential to authenticate against the storage. […]

Categories
SQL Server

Using External References with Data-Tier Applications

One method for transferring a database to a different environment is using a Data-Tier Application – in the form of a DACPAC (for schema) or BACPAC (for schema and data). Trying to use this approach with multi-database solutions is a challenge though as Data-Tier Applications don’t play nicely with cross-database objects. Let’s look at how we can […]

Categories
SQL

Calculating String Lengths

We store a wide variety of data within our platforms, some of which will inevitably be string based. Along with that comes a need to perform manipulation of those strings. When slicing, combining, or manipulating strings one element which we need to consider is the length of the string. Here I wanted to have a […]

Categories
SQL Server

Object Visibility: Who Can See What

When developing database solutions we’ll typically spend some time considering security requirements, which will result (in part) with database roles being assigned to users or groups of users. Whilst security considerations will likely be focused on what folks can do in our databases, there’s a separate impact on what they can see in them too. I’ve had more than […]

Categories
SQL Server

Modifying Data in Multi Table Views

Last time out we looked at modifying data in a view, but this only worked when we had a view referencing a single table. Here we’ll look at how we can achieve the same result for a view which references multiple tables. This one will require a little more work for us in the form of some extra […]

Categories
SQL Server

Auditing Schema Changes with DDL Triggers

A couple of weeks back we looked at how to implement DDL triggers in a database and briefly created a couple as examples. This time we’ll put that into use with a particular purpose: to audit modifications to our database schema. Storing the audit Before we get to the trigger we want to create a table to […]

Categories
SQL Server

Implementing DML Triggers

Last time out we looked at implementing DDL triggers in SQL Server and today we’re going to look at the other commonly used trigger – DML. What are DML triggers DML triggers are used to react to events caused by data manipulation language (DML) statements. These events are targeted to a specific table or view and so […]

Categories
SQL Server

Implementing DDL Triggers

In SQL Server we have the ability to create triggers to respond to events occurring within our databases or across the server. These typically come in two varieties – DDL and DML triggers. Here we’ll look at what DDL triggers are and how to implement them. What are DDL triggers A DDL trigger is a […]

Categories
SQL

Naming Scope in SQL Server

When creating items in SQL Server we aren’t able to create multiple with the same name, for example two tables named dbo.Sales. Similarly we couldn’t create a table and view with the same name. However it isn’t the case that everything we create within a database has to be named uniquely. It can depend on […]

Categories
T-SQL Tuesday

T-SQL Tuesday #161: Having Fun with T-SQL

It’s that time of the month again and this invitation from Reitse has asked us about some fun we’ve had with T-SQL in the past. Whilst I’ve used SQL Server over the years and it’s features as part of various solutions for others, I enjoy the time I can put it to work for solving […]