Articles tagged TSQL

04 July 2022
04 July 2022

What’s new in T-SQL in SQL Server 2022

0
20
There are many new features in SQL Server 2022. In relation to T-SQL querying, there are a few as well and they usually are left for last in face of many other new optimization features. Sample scenario These samples are built on the AdventureWorksDW2019 database installed in a SQL Server 2022 CTP 2. Date_Bucket Let’s … Read more
15 March 2021
15 March 2021

Count Distinct and Window Functions

0
3
Or: How to make magic tricks with T-SQL Starting our magic show, let’s first set the stage: Count Distinct doesn’t work with Window Partition Preparing the example In order to reach the conclusion above and solve it, let’s first build a scenario. Using Azure SQL Database, we can create a sample database called AdventureWorksLT, a … Read more
06 March 2014
06 March 2014

On Handling Dates in SQL

The calendar is inherently complex by the very nature of the astronomy that underlies the year, and the conflicting historical conventions. The handling of dates in TSQL is even more complex because, when SQL Server was Sybase, it was forced by the lack of prevailing standards in SQL to create its own ways of processing and formatting dates and times. Joe Celko looks forward to a future when it is possible to write standard SQL date-processing code with SQL Server.… Read more
14 January 2014
14 January 2014

Generating Test Data in TSQL

To test SQL, you need test data. There are usually many reasons why you can't use production data. Although it is usually enough to use a utility to generate test data, sometimes your requirements will compel you to resort to code to supplement this. Hugo shows how he used SQL and C# to generate large volumes of test data involving related columns and complex distributions.… Read more
12 June 2013
12 June 2013

Preparing to Upgrade your SQL Server

It isn't a problem to use deprecated TSQL features until it comes to the time to move the database to a server with a newer version of SQL Server, because The Upgrade Adviser tool will tell you what needs to be changed. An alternative is to flush out the use of archaic features via scripting during the development process so there are no surprises later. Jonathan Allen shows how… Read more
28 August 2012
28 August 2012

Registered Servers and Central Management Server Stores

0
42
SQL Server Management Studio (SSMS) has many features that make it particularly convenient for the database developer and DBA. Registered Servers are typical: poorly documented, but essential for the busy DBA, since they are easily scriptable via TSQL or PowerShell as well as the SSMS GUI, to access groups of servers to perform a wide range of tasks.… Read more
22 November 2011
22 November 2011

Administrating SQL Server Reporting Services – Planning, Documenting and Troubleshooting

0
88
DBAs are usually charged with the administration of Reporting Services, but are often short on guidance on how to go about such tasks as planning, documenting and troubleshooting those aspects that are specific to the SSRS service. Feodor gives some tips, custom SSMS reports, and useful TSQL queries, based on his experience.… Read more
21 July 2011
21 July 2011

CLR Performance Testing

Are Common Language Runtime routines in SQL Server faster or slower than the equivalent TSQL code? How would you go about testing the relative performance objectively? Solomon Rutzky creates a test framework to try to answer the question and comes up with some surprising results that you can check for yourselves, and offers some good advice.… Read more