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

SQLStudies

My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.

Archives: September 2017

SQL Puzzle – Prime Numbers

My goal here is to have something fun (and hopefully educational/thinky) (and yes, I did just make up the word thinky, live with it) at the end of each month. So this month it’s a puzzle. Calculate the first 10 prime numbers.

Definition of a prime number:

A Prime Number…

Read more

6 comments, 225 reads

Posted in SQLStudies on 27 September 2017

Saving and restoring session options settings

There are a fair number of options settings. ANSI_NULLS, ARITHABORT, QUOTED_IDENTIFIER, etc. Each session has its own set of configurations. They are initially set based on the user settings system configuration, then the various connection programs (SSMS for example) can override that, then the various SET commands can override that.… Read more

4 comments, 207 reads

Posted in SQLStudies on 25 September 2017

Uniquifier is a rather unique word isn’t it?

tl;dr; The uniquifier is used to make a non-unique key in a clustered index unique.

Uniquifier is a rather funny name, and yet it’s very descriptive. If there is a key that must be made unique then SQL server will add a uniquifier to, well, make it unique.

Now, why… Read more

8 comments, 1,382 reads

Posted in SQLStudies on 18 September 2017

Help! My query is too fast!

Said no one ever. Well, maybe. I have had occasions where I needed a brief pause in the middle of a batch. For example, if I’m running a big delete I might create a loop and delete in batches. If I’m having to run this for a while on an… Read more

1 comments, 2,629 reads

Posted in SQLStudies on 14 September 2017

Turn on/off Azure VMs with Powershell

T-SQL Tuesday has rolled up on us yet again. This month it’s Rob Sewell’s (b/t) turn to host and picked a subject Lets get all Posh!.

I’m a little confused, to be honest. Has anyone else heard of PoSH? No? I didn’t think so. Read more

1 comments, 179 reads

Posted in SQLStudies on 12 September 2017

There EXISTS a place where SELECT 1/0 doesn’t return an error.

Kendra Little (b/t) reminded me of this fun little trick (with fairly important ramifications) in her latest quiz on logical joins (Q7)

Using AdventureWorks2014

SELECT *
FROM Sales.SalesOrderHeader as head
WHERE EXISTS (
	SELECT 1/0 as y
	FROM Sales.SalesOrderDetail AS det
	WHERE det.SalesOrderID = head.SalesOrderID);

At… Read more

3 comments, 326 reads

Posted in SQLStudies on 7 September 2017

SQL Homework – September 2017 – Create a home lab

As I wrote my post about installing the latest version of SSDT I realized that my homework posts missed something important at the start. It’s pointless to ask someone to create a table when they don’t have someplace to do it.

There is no need to go as far as… Read more

0 comments, 220 reads

Posted in SQLStudies on 5 September 2017