Gregory Larsen

Currently a SQL Server DBA. I've been working with SQL Server since 1999. I'm an old-time mainframe DBA. My DBA career started in 1985. Currently studying to obtaining MCDBA.

Stairway to T-SQL Beyond The Basics

Stairway to T-SQL: Beyond The Basics Level 4: Using Views to Simplify Your Query

This level discusses how to use a database VIEW to simplify your Transact-SQL(T-SQL) code. By understanding how to use a VIEW you will be able to better support writing T-SQL code to meet complex business requirements. In this article I will be discussing what a database VIEW is and then providing a number of examples to help you understand how you can use a VIEW to implement different coding scenarios.

You rated this post out of 5. Change rating

2019-03-26 (first published: )

13,417 reads

Stairway to T-SQL Beyond The Basics

Stairway to T-SQL: Beyond The Basics Level 5: Storing Data in Temporary Tables

There are times when retrieving data for complex business requirement requires you to temporarily store one or more results sets for a short period of time. Typically these temporary tables are stored in the scope of the current connection, but they may also need to be available across multiple connections.

You rated this post out of 5. Change rating

2019-03-26 (first published: )

15,034 reads

Stairway to T-SQL Beyond The Basics

Stairway to T-SQL: Beyond The Basics Level 6: Using the CASE Expression and IIF Function

There are times where you need to write a single T-SQL statement that is able to return different T-SQL expressions based on the evaluation of another expression. When you need this kind of functionality you can use the CASE expression or IIF function to meet this requirement. In this Stairway level Gregory Larsen reviews the CASE and IIF syntax and showing you examples of how the CASE expression and IIF function.

You rated this post out of 5. Change rating

2019-03-26 (first published: )

17,387 reads

Stairway to T-SQL Beyond The Basics

Stairway to T-SQL: Beyond The Basics Level 8: Coding Shortcuts using += and -= Operators

No one wants to use more keystrokes than they have to when they write a chunk of T-SQL code. To help with minimizing the number of characters a T-SQL developer needs to type the Microsoft team introduced three new shortcuts operators when they release SQL Server 2008. These shorts cuts are the String Concatenation, Add EQUALS, and the Subtract EQUALS operators.

You rated this post out of 5. Change rating

2019-03-26 (first published: )

14,597 reads

Stairway to T-SQL Beyond The Basics

Stairway to T-SQL: Beyond The Basics Level 9: Dynamic T-SQL Code

There times when you need to write T-SQL code that creates specific T-SQL Code and executes it. When you do this you are creating dynamic T-SQL code. When writing dynamic T-SQL you need to understand how dynamic code opens the possibilities for a SQL injection attack.

You rated this post out of 5. Change rating

2019-03-26 (first published: )

12,803 reads

Stairway to Advanced T-SQL

Stairway to Advanced T-SQL Level 8: Functions to Generate Date and Time values

When you build applications that store records in SQL Server you will most likely have to store date and time values as part of the data. To manage all the different date related tasks you might need to perform Microsoft has introduced a number of date functions. In this stairway I will be exploring those date and time functions.

You rated this post out of 5. Change rating

2015-10-21

12,374 reads

Stairway to Advanced T-SQL

Stairway to Advanced T-SQL Level 7: Ordering Your Data Using Ranking Functions

In SQL Server there are 4 different ranking functions: RANK, DENSE_RANK, NTILE, and ROW_NUMBER. These ranking functions were introduced in SQL Server 2005. In this stairway level I will be reviewing each of these different ranking functions, and will show you how to use them by providing a few examples.

5 (2)

You rated this post out of 5. Change rating

2015-09-02

14,584 reads

Stairway to Advanced T-SQL

Stairway to Advanced T-SQL Level 3: Understanding Common Table Expressions (CTEs)

A CTE is a temporary result set defined by a simple query, and is used within the execution scope of a single INSERT, UPDATE, DELETE, or SELECT statement. In this article we will explore how to define and use CTE's.

You rated this post out of 5. Change rating

2015-03-18

2,500 reads

Stairway to T-SQL Beyond The Basics

Stairway to T-SQL: Beyond The Basics Level 7: Controlling the Flow of Your T-SQL

When you are writing TSQL code there are times when you want to perform the same logic over and over again. To accomplish this you can used the WHILE keyword. There are other times when you want to perform a conditional test and depending on the results of the test you execute one code block for the TRUE condition and possibly a different code block when the condition is FALSE. When you need to conditionally execute code based on the outcome of a condition you can used the IF keyword. In this Stairway level I will be discussing how to use the WHILE and IF constructs to control the flow of your TSQL code.

You rated this post out of 5. Change rating

2014-06-25

9,411 reads

Stairway to T-SQL DML

Stairway to T-SQL DML Level 10: Changing Data with the UPDATE Statement

Unless you are working on a reporting-only application you will probably need to update tables in your SQL Server database. To update rows in a table you use the UPDATE statement. In this level we will be discussing how to find and update records in your database, and discuss the pitfalls you might run into when using the UPDATE statement.

You rated this post out of 5. Change rating

2012-10-10

9,365 reads

Blogs

Set a Runtime Variable in an Azure DevOps Pipeline

By

Note: I DO NOT recommend this. Any changes to a pipeline should be in...

A New Word: Symptomania

By

symptomania – n. the fantasy that there’s some elaborate diagnosis out there that neatly...

Query Store Keeps Switching Itself Off, Getting it Moving Again

By

I recently received a complaint that Query Store for a particular database was turned...

Read the latest Blogs

Forums

7 sept, scheduled book

By philip.scott

Comments posted to this topic are about the item 7 sept, scheduled book

7 sept, schedlued article

By philip.scott

Comments posted to this topic are about the item 7 sept, schedlued article

6 sept, published book

By philip.scott

Comments posted to this topic are about the item 6 sept, published book

Visit the forum

Question of the Day

Azure Data Lake Storage Gen 2

Azure Data Lake Storage Gen 2 is built on ...?

See possible answers