Sql-Server

SQL: Turning off completion times in SQL Server Management Studio (SSMS)

Once again today, I was asked by a developer, how you can “turn off those annoying completion time messages in SSMS”.

A few releases of SQL Server Management Studio (SSMS) back, the product team decided that we’d all like completion times shown in the Messages output tab. I don’t share their enthusiasm for them.

For a start, a completion time was already shown here in the Properties window for the query, along with much more info:

2020-10-21

SQL Server Replication: The reports of my death are greatly exaggerated

I was reading posts in an email distribution list yesterday and someone asked if SQL Server Replication was deprecated. First up, let’s just confirm that it’s not. As Mark Twain said: “The reports of my death are greatly exaggerated”. There’s still a really strong need for it, and somewhat ironically, that need has been getting stronger lately.

Back when replication was introduced, it had a bit of a reputation for being hard to set up, and hard to look after. It was in the same category as features like clustering. If I was teaching a SQL Server 6.5 class, you could tell which students could follow instructions if they managed to get clustering working. Fortunately, it’s nothing like that today but you’ll still hear from people with “old pain”.

2020-10-15

SQL: PASS Learning Experience on Making a Cloud Transformation

I’ve been in so many companies lately where new CTOs and CIOs claim to have a cloud focus, but all they want to do is migrate all their existing systems from on-premises VMs to cloud-based VMs. They talk about making a cloud transformation but they’re not transforming anything.

I was pleased to get a chance to create a short educational series for the people at PASS to cover some of my thoughts on how to make a real transformation, not just a migration.

2020-10-09

Power BI: 5 Minutes to "Wow" and for enterprises, what's next?

Power BI is amazing. And it’s starting to appear all over the place. Many enterprises don’t know what to make of it though. Some are scared that it’ll be the “next Access” where stores of uncontrolled data end up all over the organization. Power BI’s mantra of “5 minutes to Wow” is spot on. It’s easy to be impressed. But enterprises are often struggling with “what comes next after that 5 minutes?”

2020-08-07

T-SQL 101: 78 Custom formatting dates and times in SQL Server using FORMAT

In some upcoming posts, I’ll discuss how you can change between data types, but I wanted to show you first, how you can use the FORMAT() function to convert dates and times to strings.

This query asks for the current date and time value formatted as day then month, then (four digit) year. It also includes the desired culture (en-US) which would be used if the format required any culture-specific items, such as the names of months.

2020-07-13

T-SQL 101: 77 Switching timezone offsets in SQL Server T-SQL with SWITCHOFFSET

I mentioned in the last T-SQL post how you could create a datetimeoffset value by combining a datetime2 with an offset. But sometimes you need to switch to a different offset. And that’s what the SWITCHOFFSET() function does:

In this query, I was taking a local time (that had a timezone offset of 11 hours), and switching it to the current time in Seattle (with a -7 hours offset):

2020-07-06

T-SQL 101: 76 Creating datetimeoffset values in SQL Server T-SQL with TODATETIMEOFFSET

It’s great to have SQL Server data types now that handle time zone offsets. Sometimes though, you need to combine a datetime value and an offset to produce one of these new values. That’s what the TODATETIMEOFFSET() function does:

In this example, I’ve taken 28th February 2019 and added a timezone offset of 10 hours to it:

the output data type is datetimeoffset.

The data type of the first value is actually datetime2.

2020-06-29

SQL: Previous SSMS Tips and Tricks Session

One of the more popular things I’ve ever written is my (free) SQL Server Management Studio Tips and Trips eBook.

I’ve had a few people asking why I haven’t done a video on it lately. I’m planning to do a series on it very soon.

In the meantime, here’s a session that I did with Amit and the people from Data Platform Geeks a while back: Tips and Tricks Session

2020-06-25

T-SQL 101: 75 Constructing dates and times in SQL Server using DATEFROMPARTS

I mentioned in previous T-SQL posts that one of the challenges is that there’s no standard way to write dates, so we end up having to write them as strings. Now that was a real problem in earlier versions where people would get that wrong. The DATEFROMPARTS() function added in SQL Server 2012, though, can help with this:

This query takes the year 2019, the month 2, and the day 28 and returns a date:

2020-06-22