Useful Code

SELECT INTO with IDENTITY

This is a fun one because I’ve seen numerous people struggling with identity columns in temp or freshly generated tables. For example, let’s take a look at the Person.Person table in AdventureWorks: Now, if we just want to make a copy of this table then it’s nice and simple:

That’s it… we’re done. BUT …

SELECT INTO with IDENTITYRead More »

Using In-Memory Temp Tables

Following on from the few posts I’ve written about in-memory tables I wanted to mention this useful tip you can use in order to potentially speed up your temp tables whether that be within stored procedures or maybe within an ETL process. Let’s look at the example of a stored procedure:

Now, let’s run …

Using In-Memory Temp TablesRead More »

Creating an In-Memory Table

You know what in-memory tables are (if you don’t, then refer here), and you have your in-memory filegroup (refer here), so now you need to know how to create one… First thing to note is that all in-memory tables MUST have at least one index.  With that in mind, let’s jump right in:

That’s …

Creating an In-Memory TableRead More »

Scroll to Top