Quantcast
Channel: USE – Steve Stedman
Browsing all 21 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

ROWS PRECEDING and FOLLOWING in TSQL 2012

First for this example, and a few to follow we need to create the database that we are going to play around in. USE [Master]; CREATE DATABASE [tsql2012]; GO USE [tsql2012]; -- Table to be used by Over...

View Article



Image may be NSFW.
Clik here to view.

TSQL Analytic Functions LEAD and LAG

SQL Server 2012 introduces 8 new analytic functions. This post will cover 2 of them LEAD and LAG, which can be used to reference a value in the row before or the row after the current row. If you have...

View Article

Image may be NSFW.
Clik here to view.

Using the OUTPUT Clause in TSQL for Auditing

The OUTPUT clause is often times underappreciated by the TSQL programmer.  There are many really interesting things that you can do with the OUTPUT clause, from inserting to two tables with one...

View Article

Image may be NSFW.
Clik here to view.

Cumulative Distribution Function (CDF) – Analyzing the Roll of Dice with TSQL

After the last post on Cumulative Distribution Function (CDF) or as it is known in TSQL CUME_DIST(), I realized that although I showed how to use it, I didn’t really explain what it means, or when to...

View Article

Image may be NSFW.
Clik here to view.

TSQL Pivot Table

TSQL Pivot Table?  Whats that? Here is a quick sample of how to implement a pivot table in TSQL for SQL Server. The example below creates a database called pivot, you probably already have your own...

View Article


Image may be NSFW.
Clik here to view.

SEQUENCE Sample Code from SQL Saturday in Olympia WA

The sample code below is a quick run down of the new sequence object introduced in SQL Server 2012. USE [tsql2012]; -- SEQUENCE -- using default where does this one start? --DROP SEQUENCE...

View Article

Image may be NSFW.
Clik here to view.

SQL Server 2012 IIF Statement

SQL Server 2012 introduces the IIF statement. It is very similar to the IIF statement in MS Access. I have extracted the IIF part of my presentation on Whats new in SQL Server 2012, and turned it into...

View Article

Image may be NSFW.
Clik here to view.

T-SQL 2012 Procedure sp_describe_first_result_set

SQL Server 2012 adds a new stored procedure called sp_describe_first_result_set.  This new procedure returns metadata for the result set returned from a query. The metadata is information about what...

View Article


Image may be NSFW.
Clik here to view.

Rows and Range, Preceding and Following

SQL Server 2012 adds many new features to Transact SQL (T-SQL).  One of my favorites is the Rows/Range enhancements to the over clause. These enhancements are often times referred to as the windowing...

View Article


Image may be NSFW.
Clik here to view.

DBCC CheckAlloc

Being day one of DBBC Command month at SteveStedman.com, today’s featured DBCC Command is DBCC CHECKALLOC. Description: DBCC CheckAlloc checks and can repair disk space allocation structures for a...

View Article

Image may be NSFW.
Clik here to view.

DBCC CheckFilegroup

Being day five of the DBCC Command month at SteveStedman.com, today’s featured DBCC Command is DBCC CHECKFILEGROUP. Description: DBCC CHECKFILEGROUP is used for a specific filegroup to check the disk...

View Article

Image may be NSFW.
Clik here to view.

Common Table Expressions – Terminating the Previous Statement

Day 4 of Common Table Expression Month (June) at SteveStedman.com, today I will cover the topic of terminating the previous T-SQL statement. These queries will be using that database that was set up in...

View Article

Image may be NSFW.
Clik here to view.

CTE Scope

Day 5 of Common Table Expression Month (June) at SteveStedman.com, today I will cover concepts around the scope of a CTE. The queries in the video will be using that database that was set up in a...

View Article


Image may be NSFW.
Clik here to view.

Enabling Transparent Data Encryption on SQL Server 2014

To start with for Transparent Data Encyrption (TDE) we will need to be using Enterprise (or Developer) edition of SQL Server 2014. I am using SQL Server 2014 Enterprise Edition CTP1, which is the early...

View Article

Image may be NSFW.
Clik here to view.

Introducing the DataBase Corruption Challenge (DBCC) – Week 1 Challenge

Welcome to the DataBase Corruption Challenge, this is an about weekly blog challenge where I will post a corrupt SQL Server database with some details on what happened to it. If at this point you are...

View Article


Image may be NSFW.
Clik here to view.

How To Move TempDB Files

I was asked recently how to move TempDB on SQL Server. The question specifically was how to move the TempDB files to different drives. At that point I realized that I don’t have that posted to my blog,...

View Article

Image may be NSFW.
Clik here to view.

Week 7 Database Corruption Challenge Results

The seventh week of ten in the Database Corruption Challenge went well. There were a few new participants, and many of those who have competed week over week. The first to submit a correct answer this...

View Article


Image may be NSFW.
Clik here to view.

Weird Join Delete

This confused me for a few minutes today and I wanted to share to help avoid further confusion.   The specific code was this: DELETE t2 FROM [dbo].[Table1] t1 INNER JOIN [dbo].[Table2] t2 on...

View Article

Image may be NSFW.
Clik here to view.

TSQL To Start A SQL Agent Job

Most of us are familiar with the quick and easy right clicking on an agent job an select “Start job at Step…”, but what if you need to run a job on many servers how can you kick it off manually. But...

View Article

Image may be NSFW.
Clik here to view.

Cumulative Distribution Function (CDF) – Analyzing the Roll of Dice with TSQL

After the last post on Cumulative Distribution Function (CDF) or as it is known in TSQL CUME_DIST(), I realized that although I showed how to use it, I didn’t really explain what it means, or when to...

View Article
Browsing all 21 articles
Browse latest View live




Latest Images