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

Does a Primary Key always have stats_id 1?

Back to the SQL Server Basics with Wayne

The Myth

I recently was attending a presentation where the presenter stated that the statistic with stats_id = 1 is always for the primary key (PK). The presenter made this statement based on the behavior that he has seen. However, is it… Read more

0 comments, 2,006 reads

Posted in A Discussion of SQL Server-Related Topics on 28 June 2018

SSMS reset window layout (Day 37)

SSMS is a wonderful tool. You can drag Windows around, grouped with others, split, docked, undocked, hidden… it seems endless what you can do with them. You can even change what columns you see. Invariably, with all of this customization, things go wonky. I’ve even seen windows opened up… Read more

0 comments, 2,086 reads

Posted in A Discussion of SQL Server-Related Topics on 20 June 2018

New blogger: Jamie Wick

New SQL blogger

Jamie at the 45th Parallel (South) – New Zealand

This post is just a quick shout-out. My friend and co-leader of the Richmond SQL Server User Group, Jamie Wick, has started blogging. You can catch all of the action at his blog. He has some… Read more

0 comments, 153 reads

Posted in A Discussion of SQL Server-Related Topics on 15 June 2018

Removing the time element from a datetime

Killing Time – or removing the time element from a datetime

Over the course of time, we all collect scripts and routines for helping us do our job. Recently, I ran across two routines that are removing the time element from a datetime data type that I hadn’t seen before.… Read more

1 comments, 1,540 reads

Posted in A Discussion of SQL Server-Related Topics on 7 June 2018

Removing servers from the SSMS connection dialog (Day 36)

One of the things that you will no doubt end up experiencing as a DBA is that you will see new SQL Server instances come into existence. Going right along with this is that you will see old instances die off. However, they don’t just disappear from the SSMS connection… Read more

0 comments, 462 reads

Posted in A Discussion of SQL Server-Related Topics on 16 May 2018

SSMS: Batch Separator (Day 35)

SSMS (and other SQL Server utilities) utilize a batch separator to, well, separate batches of T-SQL statements. Before we go jump into batch separators, let’s first talk about what a batch is.

Batch

Microsoft explains exactly what a batch is at this link:

A batch is a group of…

Read more

0 comments, 472 reads

Posted in A Discussion of SQL Server-Related Topics on 18 April 2018

Checking for temporary table existence

Database Code Smells

I was recently reviewing a newly created T-SQL stored procedure. This procedure was verifying temporary table existence with the following code:

IF exists (select * from tempdb..sysobjects where name like '#fg%')
DROP TABLE #fg

Seeing this takes me back to one of my favorite presentations, where I… Read more

3 comments, 1,510 reads

Posted in A Discussion of SQL Server-Related Topics on 11 April 2018

Primary Replica Jobs

This post talks about having primary replica jobs. That is, jobs that will only run on the primary replica of an availability group.

Overview

An Availability Group (AG) takes one or more databases, and copies all changes to those databases from the primary replica to all the secondary replicas. However,… Read more

0 comments, 269 reads

Posted in A Discussion of SQL Server-Related Topics on 2 April 2018

Working with tabs and spaces in SSMS (Day 34)

There are several different options available for working with tabs and spaces in SSMS. In fact, there are enough that I could make several tips out of them. I decided to just keep all the tips together.

Tabs and Spaces options

The first thing that I want to go over… Read more

0 comments, 2,643 reads

Posted in A Discussion of SQL Server-Related Topics on 21 March 2018

Using the Full Screen Mode in SSMS (Day 33)

Do you ever find yourself working on a query and realize that you need just a bit more real estate in the SSMS window? Or perhaps you find that all the toolbars, menus, etc. are cluttering things up? To solve these issues, you can toggle the full screen mode in… Read more

1 comments, 244 reads

Posted in A Discussion of SQL Server-Related Topics on 28 February 2018

Using a gMSA with SQL Server

As you already know, SQL Server runs as a service. And services require a service account to run under. While this service account is likely to be a domain service account, it could be an account on the local machine. To follow good security practices you would need to specify… Read more

10 comments, 2,540 reads

Posted in A Discussion of SQL Server-Related Topics on 19 February 2018

Connecting to a SQL Server instance – Back to Basics

Back to the SQL Server Basics with Wayne

Connecting to a SQL Server instance is one of the first things that you will do after installing SQL Server. There are different ways of connecting to the instance. Certain High Availability features offer other ways to connect. In this Back to… Read more

3 comments, 2,593 reads

Posted in A Discussion of SQL Server-Related Topics on 7 February 2018

Controlling what appears in the status bar and query tabs (Day 32)

When you run a query in SSMS, you are probably aware that the status bar contains many pieces of information about it. Things like the instance name that you are connected to, the login name used, and a few others. You can see them here:

Likewise, the tab that you… Read more

1 comments, 282 reads

Posted in A Discussion of SQL Server-Related Topics on 1 February 2018

SSMS Activity Monitor (Day 31)

SSMS provides an Activity Monitor, a process that displays various information about what all is going on with the instance. This is available by right-clicking on the server and selecting Activity Monitor, or by selecting the toolbar icon for it.

Either of these options will bring up the Activity Monitor… Read more

1 comments, 380 reads

Posted in A Discussion of SQL Server-Related Topics on 31 January 2018

Reports in SSMS (Day 30)

SSMS has a lot of reports available for you to use. Most of the reports in SSMS are off of either the server node, or the database nodes. Simply right-click the node, and select reports. The server level reports are:

And the database level reports are:

Each of these reports… Read more

0 comments, 291 reads

Posted in A Discussion of SQL Server-Related Topics on 30 January 2018

Presenting with SSMS (Day 29)

If you are presenting with SSMS, then there are some extra steps that you need to take. These steps are all for the purpose of ensuring that everyone (especially those in the back of the room) can clearly see your demo in SSMS. The fonts used in SSMS and a… Read more

1 comments, 300 reads

Posted in A Discussion of SQL Server-Related Topics on 29 January 2018

Saving SSMS Settings (Day 28)

Over the last several weeks, we have been making several changes to various settings in SSMS. Now that you have SSMS configured exactly to your liking, you need to save all of these configuration settings. You know, in case you have to start over with a fresh install. Thankfully, saving… Read more

0 comments, 261 reads

Posted in A Discussion of SQL Server-Related Topics on 28 January 2018

Comparing Query Plans (Day 27)

When you are performance tuning code, you will frequently examine the execution plans to see what is happening. As you change the code, you will look at the execution plan again. However, comparing all the changes is troublesome. Fortunately, comparing query plans has become easy in SSMS (starting in 2016).… Read more

1 comments, 305 reads

Posted in A Discussion of SQL Server-Related Topics on 27 January 2018

A month of SSMS tips and tricks

Wayne’s Tips and Tricks for SSMS

SQL Server Management Studio (SSMS ) is a program that many just launch daily (or only when they restart their computer), and they use it to navigate to various SQL Servers to manage them, either through the GUI or through a query. I’ve found… Read more

6 comments, 474 reads

Posted in A Discussion of SQL Server-Related Topics on 26 January 2018

Working with Comments (Day 26)

We all know that we should liberally document our code with comments, so that others (and even yourself) will know what the code is doing down the road. I like to start all of my code off with my classic remark block:

/******************************************************************************
$SELECTIONSTART$Description of code$SELECTIONEND$
*******************************************************************************
                               MODIFICATION LOG
*******************************************************************************…

Read more

5 comments, 281 reads

Posted in A Discussion of SQL Server-Related Topics on 26 January 2018

Older posts