Posts

Showing posts from June, 2022

SQL Server 2022 and the GENERATE-SERIES command .. a T-SQL language enhancement

Image
Hi Guys, Welcome back! I have to admit that I like to find out what is added in each new version of SQL, especially the T-SQL language part. There will be a lot to talk about .. So let's start! Today we see the first improvement of T-SQL language that the new SQL Server 2022 bring us: the GENERATE_SERIES command The GENERATE_SERIES command I bet that when we are asked to generate a series of numbers such as 1,2,3, .. or 2, 4,6 etc etc immediately we think of the CTE (the well-known "common table expression") or the function of ranking ROW_NUMBER. Someone then invents some more original but still functional approach. Let's see some ways currently used to generate a series of values: Using a CTE: WITH Cte AS ( SELECT 1 AS x UNION ALL SELECT x + 1 FROM Cte WHERE x < 5 ) SELECT * FROM Cte -- remember to add the option maxrecursion... Executing this command we will have:   Or we could use a ranking function: SELECT ROW_NUMBER () OVER (Ordery...

SQL Server 2022 and the Parameter Sensitive Plan Optimization (PSP) with example

Image
Hi guys, Today we will start talking about the features that the new SQL Server 2022 bring us. We have already talked about it here. In particular, today I want to talk to you about the new feature called   Parameter Sensitive Plan Optimization or PSP . This feature is part of the family of features known as Intelligent Query Processing and aims to improve the performance of existing workloads. I want to remark that this is a big performance improvement and one of the main highlights of this new version of SQL Server .   This improvement comes at no cost and without any changes to the application code. Parameter Sensitive Plan (PSP) Optimization   Starting from the idea that creating an execution plan (determine which is the best way to solve a Query) require resources and time. Microsoft has developed into SQL Server 2022 a mechanism to save and reuse created execution plans. Briefly, the first time a query is executed its execution plan is created and stored in th...

SQL Server, Extract the row values of which another field has maximum value

Image
Hi Guys! One of the typical requests that who writes in SQL is faced with is extract the row values of which another field has maximum value. While extracting the maximum from a column is simple, this general case is less so. The important thing is to recognize these cases . Today we will see how to solve them. Extract the row values of which another field has maximum value Suppose having a table inventory_movements that contain a list of movements. The fields in this table are: the product, the entry date of the movement and the value of the product on the date of entry of the movement. This below is the table structure Create Table inventory_movement (id int identity(1,1) primary key , Product varchar (40), Datemov datetime , ValueMov float ) To better understand the concept let’s do an example I insert some data into the table: Insert into inventory_movements (Product, ValueMov, Datemov) values ( 'ACME Bird Seeds v1' , 1.21, ...

BREAKING NEWS! SQL Server 2022 public preview for LINUX is now available! Let's install it step by step!

Image
Hi Guys, We are experiencing a great period of previews! Three days ago we had the debut of the public preview of SQL Server 2022 for LINUX . ...how not to take a look at it? Indeed .. how not to install it? Follow me!     P.S. Do you want to see how to install SQL Server 2019 for Linux? click here     SQL Server 2022 public preview for LINUX We must say that this news is the continuation of last week's announcement of SQL Server 2022 public preview Linux supported platforms are: Red Hat Enterprise Linux 8.0 - 8.5 Server Ubuntu 20.04 LTS Docker Engine 1.8+ on Linux   SUSE Linux Enterprise Server (SLES) support will be added in a later release.   Installation Here the installation step by step.   Open a terminal in your Ubuntu 20.04 lts   All the procedure will happen inside the terminal.   Now type the following command to import the public repository GPG keys. The password will be asked  At the end the message OK must appear. wget...

NEWS! NEWS! SQL Server Management Studio 19.0 Preview 2 ..the news that it bring to us!

Image
Hi Guys, Welcome to this post! A few days ago (it was the 05-24-2022) the SQL Server Management Studio 19.0 (Preview 2) has been released. The integrated environment for managing your SQL Server infrastructure changes its major version from 18 to 19! Take this journey to discover what's new with me! We will see all the news. Enjoy! SQL Server Management Studio 19.0 (Preview 2)     One of the unwritten laws of the disclosure says that when a software change its major version, something of big it has to be there! We look at the change log, to see if so .. This is the list of changes:   As it already happened from version 18 the installation of the Management Studio install also the last Azure Data Studio .  This new preview version of the SMSS install the Azure Data Studio Version 1.36.2    Speaking of Always Encrypted technology , there is also the possibility to choose the protocol: From this version the connection of the SMSS to the database engine wi...