How To Install Microsoft SQL Server 2022: Download SQL Server 2022 Installer

Microsoft SQL ServerThis article is part of the series on How To Install Microsoft SQL Server 2022; I do not claim to be an expert on SQL Server and this series is installing SQL Server in a development/testing/demo environment. If you’re installing SQL into a production environment there will be additional work required to harden the SQL Server and avoid security issues.

All editions of Microsoft SQL Server can be downloaded from here; the edition I am using is the Developer Edition, the download button for which is in the lower left corner of page:

Microsoft SQL Server download page

Continue reading “How To Install Microsoft SQL Server 2022: Download SQL Server 2022 Installer”

How To Install Microsoft SQL Server 2022: Server Features

Microsoft SQL ServerThis article is part of the series on How To Install Microsoft SQL Server 2022; I do not claim to be an expert on SQL Server and this series is installing SQL Server in a development/testing/demo environment. If you’re installing SQL into a production environment there will be additional work required to harden the SQL Server and avoid security issues.

In this series, I will be installing the Developer edition of Microsoft SQL Server 2022; there are eight features available to SQL Server, of which I will be installing four (the feature name is italicised):

Feature Description
SQL Server Database Engine SQL Server Database Engine includes the Database Engine, the core service for storing, processing, and securing data, replication, full-text search, tools for managing relational and XML data, in database analytics integration, and PolyBase integration for access to heterogeneous data sources, and Machine Learning Services to run Python and R scripts with relational data.
Analysis Services Analysis Services includes the tools for creating and managing online analytical processing (OLAP) and data mining applications.
Reporting Services Reporting Services includes server and client components for creating, managing, and deploying tabular, matrix, graphical, and free-form reports. Reporting Services is also an extensible platform that you can use to develop report applications.
Integration Services Integration Services is a set of graphical tools and programmable objects for moving, copying, and transforming data. It also includes the Data Quality Services (DQS) component for Integration Services.
Master Data Services Master Data Services (MDS) is the SQL Server solution for master data management. MDS can be configured to manage any domain (products, customers, accounts) and includes hierarchies, granular security, transactions, data versioning, and business rules, as well as an Add-in for Excel that can be used to manage data.
Machine Learning Services (In-Database) Machine Learning Services (In-Database) supports distributed, scalable machine learning solutions using enterprise data sources. In SQL Server 2016, the R language was supported. SQL Server 2022 (16.x) supports R and Python.
Data Virtualization with PolyBase Query different types of data on different types of data sources from SQL Server.
Azure connected services SQL Server 2022 (16.x) extends Azure connected services and features including Azure Synapse Link, Microsoft Purview access policies, Azure extension for SQL Server, pay-as-you-go billing, and the link feature for SQL Managed Instance.

Full details of the features and functionality of SQL Server 2022 can be found here.

How To Install Microsoft SQL Server 2022: Available Editions

Microsoft SQL ServerThis article is part of the series on How To Install Microsoft SQL Server 2022; I do not claim to be an expert on SQL Server and this series is installing SQL Server in a development/testing/demo environment. If you’re installing SQL into a production environment there will be additional work required to harden the SQL Server and avoid security issues.

There are a number of editions of Microsoft SQL Server available:

Edition Definition
Express SQL Server Express edition is the entry-level, free database and is ideal for learning and building desktop and small server data-driven applications. It is the best choice for independent software vendors, developers, and hobbyists building client applications.
Developer SQL Server Developer edition lets developers build any kind of application on top of SQL Server. It includes all the functionality of Enterprise edition, but is licensed for use as a development and test system, not as a production server. SQL Server Developer is an ideal choice for people who build and test applications.
Web SQL Server Web edition is a low total-cost-of-ownership option for Web hosters (including choosing Web edition on IaaS on Azure) and Web VAPs to provide scalability, affordability, and manageability capabilities for small to large-scale Web properties.
Standard SQL Server Standard edition delivers basic data management and business intelligence database for departments and small organizations to run their applications and supports common development tools for on-premises and cloud, enabling effective database management with minimal IT resources.
Enterprise The premium offering, SQL Server Enterprise edition delivers comprehensive high-end datacenter capabilities with blazing-fast performance, unlimited virtualization, and end-to-end business intelligence, enabling high service levels for mission-critical workloads and end-user access to data insights.

Full details of the editions of Microsoft SQL Server can be read here.

The environment I am installing is for development, testing and demo purposes. I recently checked the licence for the Developer Edition to check if it allowed more than just development and testing; specifically, I was interested in the possibility of using it for demo purposes and found that this was a permitted use.

This was good news and the Developer Edition is the one which I will be installing in this series; the version doesn’t actually make much difference to the install process, so you should be able to use this series for installing any of the editions.

How To Install Microsoft SQL Server 2022: Series Index

Microsoft SQL ServerI’ve been creating a new dev/demo/test environment recently and have already posted some articles about how I install and configure Windows on the servers; as I am also installing the latest version of SQL Server, I decided to cover this in a series as well.

I do not claim to be an expert on SQL Server and this series is installing SQL Server in a development/testing/demo environment. If you’re installing SQL into a production environment there will be additional work required to harden the SQL Server and avoid security issues.

The series index, below will automatically update as articles in the series go live, os make sure to check back regularly (there should be two posts a week).

How To Install Microsoft SQL Server 2022
Install SQL Server Integration Services
Available Editions
Server Features
Download SQL Server 2022 Installer
Install SQL Server Database Engine
Download SQL Server Management Studio
Install SQL Server Management Studio
Download SQL Server Reporting Services
Install SQL Server Reporting Services
Configure SQL Server Reporting Services
Change SQL Server Reporting Services maxRequestLength Setting
Install SQL Server Analysis Services
SSIS Configuration For Named Instances
SSIS Configuration For Named Instances
SSIS Configuration For Named Instances

Can Microsoft SQL Server 2022 Developer Edition be Used for Demos and Testing?

Microsoft SQL ServerI’ve been creating a new dev/demo/test environment recently and have already posted some articles about how I install and configure Windows on the servers; as I am also installing the latest version of SQL Server I thought that I’d post articles about that as well, which is coming up soon.

One though occurred to me though and that was which version of the SQL Server I could use with a valid licence. I preferred to use SQL Developer over Express, just to avoid any limitations I might run into.

That said, licences aren’t really something I’ve been that involved with before, so I did a little digging. In the old days, there was a license agreement within the installation folders of SQL Server, but it seems these have now been moved online.

After selecting the details for SQL Server 2022 Developer Edition I was taken to this page which starts with exactly the sort of information for which I was looking.

1.       INSTALLATION AND USE RIGHTS.
a.       SQL Server Developer.
i.           General. You may install and use copies of the software on any device, including third party shared devices, to design, develop, test and demonstrate your programs. You may not use the software in a production environment.
ii.         Demonstration. Any person that has access to your internal network may install and use copies of the software to demonstrate use of your programs with the software. Those copies may not be used for any other purpose.
iii.       User Testing. Your end users may access the software to perform acceptance tests on your programs.

As you can see from the above, my purposes of using SQL Server 2022 Developer Edition for development, demonstrations and testing are all valid use cases under the license.

There is also a detailed licensing guide available which contains another possibly relevant piece of information (my emphasis):

SQL Server Developer Edition is a fully featured version of SQL Server software—including all the features and capabilities of Enterprise Edition—licensed for development, test and demonstration purposes only. SQL Server Developer Edition may not be used in a production environment. Any test data that was used for design, development or test purposes must be removed prior to deploying the software for production use.

To my reading, you can use Developer Edition for testing, but cannot treat it like a staging database for loading or preparing data for transfer to production. This isn’t something I was planning on doing, but it’s good to know that this isn’t permitted with the Developer Edition; that could be a job to do on an install of the Express Edition.

SQL Snippets: Select Primary Keys for All Tables in Database

Microsoft SQL ServerThis post is part of the series on SQL Snippets.

The following SQL snippet will select all primary keys for all tables in the database in which the script is run.

/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
SELECT ['Table'].TABLE_NAME ,['Column'].COLUMN_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS ['Table'] INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS ['Column'] ON ['Column'].CONSTRAINT_NAME = ['Table'].CONSTRAINT_NAME WHERE ['Table'].CONSTRAINT_TYPE = 'PRIMARY KEY'

I used this script recently so that I could add primary keys to the Dymamics 365 BC Table Reference website.

SQL Snippets: Select All Fields for All Tables In Database

Microsoft SQL ServerThis post is part of the series on SQL Snippets.

The following SQL snippet will select all fields for all tables in the selected database returning formatted column types.

/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
SELECT ['Tables'].name AS 'Table Name' ,['Columns'].column_id AS 'Column ID' ,['Columns'].name AS 'Column Name' ,CASE ['Types'].name WHEN 'int' THEN ['Types'].name WHEN 'tinyint' THEN ['Types'].name WHEN 'smallint' THEN ['Types'].name WHEN 'bigint' THEN ['Types'].name WHEN 'uniqueidentifier' THEN ['Types'].name WHEN 'timestamp' THEN ['Types'].name WHEN 'datetime' THEN ['Types'].name WHEN 'image' THEN ['Types'].name WHEN 'text' THEN ['Types'].name WHEN 'varbinary' THEN ['Types'].name + '(' + CAST(['Columns'].max_length AS VARCHAR(10)) + ')' WHEN 'binary' THEN ['Types'].name + '(' + CAST(['Columns'].max_length AS VARCHAR(10)) + ')' WHEN 'char' THEN ['Types'].name + '(' + CAST(['Columns'].max_length AS VARCHAR(10)) + ')' WHEN 'varchar' THEN ['Types'].name + '(' + CAST(['Columns'].max_length AS VARCHAR(10)) + ')' WHEN 'nvarchar' THEN ['Types'].name + '(' + CAST(['Columns'].max_length AS VARCHAR(10)) + ')' WHEN 'decimal' THEN ['Types'].name + '(' + CAST(['Columns'].precision AS VARCHAR(10)) + ',' + CAST(['Types'].scale AS VARCHAR(10)) + ')' WHEN 'numeric' THEN ['Types'].name + '(' + CAST(['Columns'].precision AS VARCHAR(10)) + ',' + CAST(['Types'].scale AS VARCHAR(10)) + ')' END AS'Data Type' FROM sys.tables AS ['Tables'] INNER JOIN sys.columns AS ['Columns'] ON ['Columns'].object_id = ['Tables'].object_id INNER JOIN sys.types AS ['Types'] ON ['Types'].system_type_id = ['Columns'].system_type_id WHERE ['Tables'].type = 'U'

Change Text in Stored Procedure on Microsoft SQL Server

Microsoft SQL ServerI did some work for a client recently creating a script which they could run after copying their live Microsoft Dynamics GP system to a development server. This script did a variety of tasks, one of which was to change the folder location to which Post Master Enterprise was exporting a generated SSRS report as a PDF; this path was embedded within a stored procedure.

I’ve previously written a SQL script which updated SQL views. I was able to use that script as the basis for this one which replaces text within a specific stored procedure.

The first highlighted section is the path on the live server, the second the path on the dev server and the third is the name of the stored procedure to be updated:

/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
DECLARE @SprocDefinition AS NVARCHAR(max) SELECT @SprocDefinition = REPLACE( REPLACE(['SQL Modules'].definition, 'CREATE PROC', 'ALTER PROC') ,'\\SQL01\Dynamics Central\CompanyA\Invoices\','\\SQL02\Dynamics Central\CompanyA\Invoices\') FROM sys.all_objects AS ['All Objects'] LEFT JOIN sys.sql_modules AS ['SQL Modules'] ON ['SQL Modules'].object_id = ['All Objects'].object_id WHERE ['All Objects'].name = 'zDP_ESS80000_PostSSRS' EXEC (@SprocDefinition) GO

How to Enable the Microsoft SQL Server Database Mail Feature

Microsoft SQL ServerI’ve done work for a few clients recently where I’ve created stored procedures or triggers in SQL Server which needed to send email. One of them was for a Microsoft Dynamics GP client where they wanted to send an email when a PR was converted to PO; sending emails in tis way uses a part of SQL Server called Database Mail.

Database Mail is installed but not configured by default, so using it requires that it be configured. I’ve not done this personally myself until recently when I needed to configure my demo VM to send this type of custom workflow notifications.

To enable Database Mail launch SSMS and connect to the SQL Server. Expand the Management node and right click on Database Mail and select Configure Database Mail:

SSMS Database Mail popup menu

Continue reading “How to Enable the Microsoft SQL Server Database Mail Feature”

PowerShell Script to Change Language of SSRS Reports

Microsoft SQL ServerMicrosoft Dynamics GP ships with a set of standard SSRS reports which includes many useful reports which clients want to use. However, these reports ship with the language set to en-US which means all the numbers could out as US dollars. For a UK based client this isn’t very useful. There are also lots of reports which would need to be updated.

I looked into this years ago with a colleague and the PowerShell script below is our solution. The script does three things:

  1. Download the reports from SSRS to a folder.
  2. Changes the language code.
  3. Uploads the reports from the folder back into SSRS.

The script will download every rdl from SSRS maintaining the folder structure so that it is able to upload the files back into their original place.

There may be a better way of doing this, but we’re not PowerShell experts and this approach does work and has been used quite a few times now.

The script is hardcoded to convert from en-US to en-GB; I have highlighted the destination language to make finding it easy should you want to change it to another language.

There are two settings which will be prompted for when the script runs:

  • ServerName which is the name of the SSRS server.
  • fullFolderPath which is a folder on the local PC to which the reports will be downloaded.
/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
$ServerName = Read-Host -Prompt 'Please input a server name' $fullFolderPath = Read-Host -Prompt 'Please input the folder path e.g. H:\SSRS Update\' #note this is tested on PowerShell v2 and SSRS 2008 R2 [void][System.Reflection.Assembly]::LoadWithPartialName("System.Xml.XmlDocument"); [void][System.Reflection.Assembly]::LoadWithPartialName("System.IO"); $ReportServerUri = "http://$($ServerName)/ReportServer/ReportService2005.asmx"; $Proxy = New-WebServiceProxy -Uri $ReportServerUri -Namespace SSRS.ReportingService2005 -UseDefaultCredential ; #check out all members of $Proxy #$Proxy | Get-Member #http://msdn.microsoft.com/en-us/library/aa225878(v=SQL.80).aspx #second parameter means recursive $items = $Proxy.ListChildren("/", $true) | ` select Type, Path, ID, Name | ` Where-Object {$_.type -eq "Report"}; #create a new folder where we will save the files #PowerShell datetime format codes http://technet.microsoft.com/en-us/library/ee692801.aspx #create a timestamped folder, format similar to 2011-Mar-28-0850PM $folderName = Get-Date -format "yyyy-MMM-dd-hhmmtt"; $fullFolderName = $fullFolderPath + $folderName; [System.IO.Directory]::CreateDirectory($fullFolderName) | out-null foreach($item in $items) { #need to figure out if it has a folder name $subfolderName = split-path $item.Path; $reportName = split-path $item.Path -Leaf; $fullSubfolderName = $fullFolderName + $subfolderName; if(-not(Test-Path $fullSubfolderName)) { #note this will create the full folder hierarchy [System.IO.Directory]::CreateDirectory($fullSubfolderName) | out-null } $rdlFile = New-Object System.Xml.XmlDocument; [byte[]] $reportDefinition = $null; $reportDefinition = $Proxy.GetReportDefinition($item.Path); #note here we're forcing the actual definition to be #stored as a byte array #if you take out the @() from the MemoryStream constructor, you'll #get an error [System.IO.MemoryStream] $memStream = New-Object System.IO.MemoryStream(@(,$reportDefinition)); $rdlFile.Load($memStream); $fullReportFileName = $fullSubfolderName + "\" + $item.Name + ".rdl"; #Write-Host $fullReportFileName; $rdlFile.Save( $fullReportFileName); } function ReplaceText($fileInfo) { if( $_.GetType().Name -ne 'FileInfo') { # i.e. reject DirectoryInfo and other types return } $old = 'en-US' $new = 'en-GB' (Get-Content $fileInfo.FullName) | % {$_ -replace $old, $new} | Set-Content -path $fileInfo.FullName "Processed: " + $fileInfo.FullName } function UploadReports ($reportServerName = $(throw "reportServerName is required."), $fromDirectory = $(throw "fromDirectory is required."), $serverPath = $(throw "serverPath is required.")) { Write-Output "Connecting to $reportServerName" $reportServerUri = "http://{0}/ReportServer/ReportService2005.asmx" -f $reportServerName $proxy = New-WebServiceProxy -Uri $reportServerUri -Namespace SSRS.ReportingService2005 -UseDefaultCredential Write-Output "Inspecting $fromDirectory" # coerce the return to be an array with the @ operator in case only one file $files = @(get-childitem $fromDirectory *.rdl |where-object {!($_.psiscontainer)}) $uploadedCount = 0 foreach ($fileInfo in $files) { $file = [System.IO.Path]::GetFileNameWithoutExtension($fileInfo.FullName) $percentDone = (($uploadedCount/$files.Count) * 100) Write-Progress -activity "Uploading to $reportServerName$serverPath" -status $file -percentComplete $percentDone Write-Output "%$percentDone : Uploading $file to $reportServerName$serverPath" $bytes = [System.IO.File]::ReadAllBytes($fileInfo.FullName) $warnings = $proxy.CreateReport($file, $serverPath, $true, $bytes, $null) if ($warnings) { foreach ($warn in $warnings) { Write-Warning $warn.Message } } $uploadedCount += 1 } }` cd $fullFolderName $files = Get-ChildItem . -recurse $files | % { ReplaceText( $_ ) } $UploadFiles = Get-ChildItem . -Recurse -Directory foreach($uploadFolder in $uploadFiles){ $uploadFolderPath = $uploadFolder.FullName.Replace($fullFolderName, "") UploadReports $ServerName "$($fullFolderName)$($uploadFolderPath)" "$($uploadFolderPath.Replace("\","/"))" }