### Navigate to Setup Directory Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/security/ledger/azure-sql-database/README.md Change the current directory to the setup folder within the demo's directory to run the setup script. Example path provided for Windows. ```powershell cd "C:\sql-server-samples\samples\features\security\ledger\azure-sql-database\setup" ``` -------------------------------- ### Getting Started with React Tutorial Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/json/reactjs/dotnet-comments-app/wwwroot/index.html To begin the tutorial, remove the script tag that loads scripts/example.js and start writing your own JavaScript code in this area. ```javascript // To get started with this tutorial running your own code, simply remove // the script tag loading scripts/example.js and start writing code here. ``` -------------------------------- ### Setup Customization Parameters Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/sql-assessment-api/notebooks/SQLAssessmentAPITutorialNotebook.ipynb Sets up the necessary path and server instance parameters for customization examples. Ensure the path points to your customization JSON files and the server instance is correctly configured. ```powershell #Setup three parameters that are used in all the customization examples below #$samplesPath='' $samplesPath='C:\SQLAsmnt\CustomizationSamples' $samplesPath #$serverInstance = Get-SqlInstance -ServerInstance 'localhost' $serverInstance = Get-SqlInstance -ServerInstance '.\sql2017express' $serverInstance $sqlDbMaster = $serverInstance | Get-SqlDatabase -Name master $sqlDbMaster ``` -------------------------------- ### Navigate to Setup Directory Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/security/always-encrypted-with-secure-enclaves/azure-sql-database-sgx/README.md Change the current directory to the setup folder within the downloaded repository. This is a prerequisite for running the setup script. ```powershell cd "C:\sql-server-samples\samples\features\security\always-encrypted-with-secure-enclaves\azure-sql-database\setup" ``` -------------------------------- ### Install Gulp Globally Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/databases/wide-world-importers/wwi-app/wwwroot/lib/webcomponentsjs/CONTRIBUTING.md Installs the Gulp command-line tool globally on your system. This is a one-time setup step. ```bash sudo npm install -g gulp ``` -------------------------------- ### SQL Server Initialization Script Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/containers/dtc/README.md This script is executed when the SQL Server containers start. It waits for the server to be ready and then runs the initialization SQL scripts. This example shows the initialization for the publisher/distributor container. ```bash #!/bin/bash /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -d master -i /usr/config/db-init.sql ``` -------------------------------- ### Discover and Install Mockery using PEAR Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/mockery/mockery/docs/getting_started/installation.rst These commands discover the necessary PEAR channels and install Mockery with all its dependencies. ```bash sudo pear channel-discover pear.survivethedeepend.com sudo pear channel-discover hamcrest.googlecode.com/svn/pear sudo pear install --alldeps deepend/Mockery ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/django/README.md Installs all required dependencies for the Bootcamp project using pip. Ensure Python 2.7.x and Django 1.9 are installed first. ```bash pip install -U -r requirements.txt ``` -------------------------------- ### Basic Carbon Usage Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/nesbot/carbon/readme.md Demonstrates creating Carbon instances, manipulating dates and times, and formatting output. Includes examples for getting the current time, adding/subtracting time units, and creating dates from specific values. ```php printf("Right now is %s", Carbon::now()->toDateTimeString()); printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver')); //implicit __toString() $tomorrow = Carbon::now()->addDay(); $lastWeek = Carbon::now()->subWeek(); $nextSummerOlympics = Carbon::createFromDate(2012)->addYears(4); $officialDate = Carbon::now()->toRfc2822String(); $howOldAmI = Carbon::createFromDate(1975, 5, 21)->age; $noonTodayLondonTime = Carbon::createFromTime(12, 0, 0, 'Europe/London'); $worldWillEnd = Carbon::createFromDate(2012, 12, 21, 'GMT'); // Don't really want to die so mock now Carbon::setTestNow(Carbon::createFromDate(2000, 1, 1)); // comparisons are always done in UTC if (Carbon::now()->gte($worldWillEnd)) { die(); } // Phew! Return to normal behaviour Carbon::setTestNow(); if (Carbon::now()->isWeekend()) { echo 'Party!'; } echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago' // ... but also does 'from now', 'after' and 'before' // rolling up to seconds, minutes, hours, days, months, years $daysSinceEpoch = Carbon::createFromTimestamp(0)->diffInDays(); ``` -------------------------------- ### Install Composer Dependencies Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/doctrine/instantiator/CONTRIBUTING.md Navigate to the project directory and install dependencies using Composer. This involves downloading the installer, and then updating the project's dependencies. ```sh $ cd Instantiator $ curl -s https://getcomposer.org/installer | php $ php composer.phar update ``` -------------------------------- ### SQL Server Version Range Examples Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/sql-assessment-api/docs/Reference/JSONConfiguration.md Examples of version range strings and their corresponding matches. ```plaintext "10.0" ``` ```plaintext "[10.0, 13.0]" ``` ```plaintext "(10.0, 13.0)" ``` ```plaintext "[10.0, 13.1)" ``` ```plaintext "(10.0, 13.1]" ``` ```plaintext "[10.0,)" ``` ```plaintext "(10.0,)" ``` ```plaintext "(,10.0]" ``` ```plaintext "(,10.0)" ``` -------------------------------- ### Transition to Pay-as-you-go with Unlimited Virtualization Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/manage-payg-transition/README.md This example demonstrates switching all machines to pay-as-you-go in a single specified subscription immediately, while enabling unlimited virtualization. ```powershell .\manage-payg-transition.ps1 ` -SubId "00000000-0000-0000-0000-000000000000" ` -UsePcoreLicense Yes ``` -------------------------------- ### Install Azure CLI Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/security/tde-sql2019-standard/TDE_on_Standard_EKM.ipynb Use this command to install the Azure CLI. Ensure the Python scripts folder is in your PATH. ```bash pip install --user azure-cli ``` -------------------------------- ### SQL Assessment API Quick Start Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/sql2019notebooks/README.md Provides a quick start guide for using the SQL Assessment API in Azure Data Studio. This notebook helps evaluate SQL Server configurations against best practices. ```notebook # SQL Assessment API Quick Start ``` -------------------------------- ### Build and Run Sample Commands Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/json/angularjs/dotnet-tour-of-heroes/README.md Execute these commands in sequence from the project root to restore packages, build, and run the sample application. ```bash npm install dotnet restore dotnet build dotnet run ``` -------------------------------- ### Clone Repository Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/databases/wide-world-importers/wwi-app/wwwroot/public/README.md Use this command to clone the repository to your local machine. This is one of the options to get started with the template. ```bash git clone https://github.com/BlackrockDigital/startbootstrap-blog-post.git ``` -------------------------------- ### Set up a Routing System Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/symfony/routing/README.md Demonstrates how to set up a fully working routing system by defining routes, a request context, and a URL matcher. ```php use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Matcher\UrlMatcher; use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\Route; $routes = new RouteCollection(); $routes->add('hello', new Route('/hello', array('controller' => 'foo'))); $context = new RequestContext(); // this is optional and can be done without a Request instance $context->fromRequest(Request::createFromGlobals()); $matcher = new UrlMatcher($routes, $context); $parameters = $matcher->match('/hello'); ``` -------------------------------- ### Clone PHPUnit Repository Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/phpunit/phpunit/CONTRIBUTING.md Clone the PHPUnit project from its Git repository to start contributing. Navigate into the cloned directory to proceed with setup. ```bash $ git clone git://github.com/sebastianbergmann/phpunit.git $ cd phpunit ``` -------------------------------- ### Get Character at Index using `at()` Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/danielstjules/stringy/README.md Retrieves the character at a specific index. Supports both instance and static methods. Indexes start at 0. ```php S::create('fòô bàř', 'UTF-8')->at(6); S::at('fòô bàř', 6, 'UTF-8'); // 'ř' ``` -------------------------------- ### Transition to Pay-as-you-go with Exclusions Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/manage-payg-transition/README.md This example shows how to transition machines to pay-as-you-go using a list of subscriptions from a CSV file, while excluding VMs tagged with 'DoNotActivate:True' and not using unlimited virtualization. ```powershell .\manage-payg-transition.ps1 ` -SubId MySubscription.csv -ExclusionTag DoNotActivate:True ``` -------------------------------- ### Install PHPUnit_MockObject with Composer Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/phpunit/phpunit-mock-objects/README.md Add PHPUnit_MockObject as a local dependency to your project by including it in your composer.json file. This example shows a minimal configuration for version 2.3. ```json { "require": { "phpunit/phpunit-mock-objects": "2.3.*" } } ``` -------------------------------- ### Create a Simple Framework with HttpKernel Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/symfony/http-kernel/README.md A basic example demonstrating how to set up a functional framework using HttpKernel, RouteCollection, UrlMatcher, and ControllerResolver. Requires Request, Route, RequestContext, EventDispatcher, and RouterListener. ```php $routes = new RouteCollection(); $routes->add('hello', new Route('/hello', array('_controller' => function (Request $request) { return new Response(sprintf("Hello %s", $request->get('name'))); } ))); $request = Request::createFromGlobals(); $context = new RequestContext(); $context->fromRequest($request); $matcher = new UrlMatcher($routes, $context); $dispatcher = new EventDispatcher(); $dispatcher->addSubscriber(new RouterListener($matcher)); $resolver = new ControllerResolver(); $kernel = new HttpKernel($dispatcher, $resolver); $kernel->handle($request)->send(); ``` -------------------------------- ### Exact String Match Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/sql-assessment-api/docs/Customization/TargetPattern.md If a string does not start with a slash, it is treated as an exact string match. For example, '_Linux_' is equivalent to the regular expression '_/^Linux$/_'. ```regex "_Linux_" ``` -------------------------------- ### Scheduled Pay-as-you-go Transition Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/manage-payg-transition/README.md This example demonstrates scheduling a pay-as-you-go transition for all subscriptions at a specific UTC time using an automation account and region. Unlimited virtualization is not explicitly enabled. ```powershell .\manage-payg-transition.ps1 ` -SubId "00000000-0000-0000-0000-000000000000" ` -RunAt "2025-05-01 00:00:00" -AutomationAccount MyAutomation -Location "EastUS" ``` -------------------------------- ### Enable All Debug Tools Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/symfony/debug/README.md Call the `enable()` method on the main `Debug` class to activate all debugging utilities. This is the simplest way to get started with debugging. ```php use Symfony\Component\Debug\Debug; Debug::enable(); ``` -------------------------------- ### Basic Translation Setup in PHP Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/symfony/translation/README.md Demonstrates initializing the Translator, setting fallback locales, adding an array loader, registering a translation resource, and performing a basic translation. ```php use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\MessageSelector; use Symfony\Component\Translation\Loader\ArrayLoader; $translator = new Translator('fr_FR', new MessageSelector()); $translator->setFallbackLocales(array('fr')); $translator->addLoader('array', new ArrayLoader()); $translator->addResource('array', array( 'Hello World!' => 'Bonjour', ), 'fr'); echo $translator->trans('Hello World!')."\n"; ``` -------------------------------- ### Get Mock Object from Expectation Chain Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/mockery/mockery/docs/reference/expectations.rst Use `getMock()` to return the current mock object from an expectation chain, allowing for single-statement mock setups. ```php $mock = \Mockery::mock('foo')->shouldReceive('foo')->andReturn(1)->getMock(); ``` -------------------------------- ### Add Diff Package Dependency to composer.json Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/sebastian/diff/README.md To include the Diff package in your project, add it to your composer.json file under the 'require' section. This example shows a minimal setup. ```json { "require": { "sebastian/diff": "*" } } ``` -------------------------------- ### Run Columnstore Performance Sample Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/tutorials/node.js/RHEL/README.md Execute the Columnstore performance improvement sample application after setting up the table. This demonstrates how to leverage Columnstore indexes for better performance. ```bash node columnstore.js ``` -------------------------------- ### Install Comparator using Composer Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/sebastian/comparator/README.md Add Comparator as a local dependency to your project by including it in your composer.json file. This example shows a minimal configuration for version ~1.2. ```JSON { "require": { "sebastian/comparator": "~1.2" } } ``` -------------------------------- ### Setup Database and Tables for Performance Testing Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/unicode/notebooks/Perf_Latin.ipynb Creates a database with a UTF8 collation and defines four tables: two for UTF-16 and UTF-8 data, and two with page data compression enabled. This setup is crucial for comparing insert performance. ```sql USE master; DROP DATABASE IF EXISTS LatinDatabase; CREATE DATABASE LatinDatabase COLLATE LATIN1_GENERAL_100_CI_AS_SC_UTF8 GO USE LatinDatabase GO DROP TABLE IF EXISTS dbo.Inserts_UTF16 CREATE TABLE dbo.Inserts_UTF16( ID int IDENTITY(1,1) NOT NULL PRIMARY KEY , col1 NVARCHAR(50) NOT NULL) GO DROP TABLE IF EXISTS dbo.Inserts_UTF8 CREATE TABLE dbo.Inserts_UTF8( ID int IDENTITY(1,1) NOT NULL PRIMARY KEY , col1 VARCHAR(50) NOT NULL) GO DROP TABLE IF EXISTS dbo.Inserts_UTF16_Compressed CREATE TABLE dbo.Inserts_UTF16_Compressed( ID int IDENTITY(1,1) NOT NULL PRIMARY KEY , col1 NVARCHAR(50) NOT NULL) WITH (DATA_COMPRESSION = PAGE) GO DROP TABLE IF EXISTS dbo.Inserts_UTF8_Compressed CREATE TABLE dbo.Inserts_UTF8_Compressed( ID int IDENTITY(1,1) NOT NULL PRIMARY KEY , col1 VARCHAR(50) NOT NULL) WITH (DATA_COMPRESSION = PAGE) GO ``` -------------------------------- ### Clone Swift Mailer Repository with Git Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/swiftmailer/swiftmailer/doc/installing.rst Clone the Swift Mailer repository from GitHub to get the latest source code. This requires Git to be installed on your system. ```bash $ cd source_code/ $ git clone git://github.com/swiftmailer/swiftmailer.git swiftmailer Initialized empty Git repository in /Users/chris/source_code/swiftmailer/.git/ remote: Counting objects: 6815, done. remote: Compressing objects: 100% (2761/2761), done. remote: Total 6815 (delta 3641), reused 6326 (delta 3286) Receiving objects: 100% (6815/6815), 4.35 MiB | 162 KiB/s, done. Resolving deltas: 100% (3641/3641), done. Checking out files: 100% (1847/1847), done. $ cd swiftmailer/ $ ls CHANGES LICENSE ... ``` -------------------------------- ### Install Dependencies and Run Tests Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/phpspec/prophecy/CONTRIBUTING.md Use these commands to install project dependencies and execute the test suite to ensure your changes do not break existing functionality. ```bash $> composer install --prefer-dist ``` ```bash $> vendor/bin/phpspec run ``` -------------------------------- ### Install GlobalState with Composer Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/sebastian/global-state/README.md To add GlobalState as a local, per-project dependency, include it in your project's composer.json file. This example shows a minimal composer.json for dependency definition. ```json { "require": { "sebastian/global-state": "1.0.*" } } ``` -------------------------------- ### List All Commands Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/symfony/console/Tests/Fixtures/application_run3.txt Use this command to list all available commands in the application. No setup is required. ```bash php app/console list ``` -------------------------------- ### Functional Test HttpKernel Framework Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/symfony/http-kernel/README.md Example of functional testing for a framework built with HttpKernel using the Client component. Asserts the response content after making a GET request. ```php $client = new Client($kernel); $crawler = $client->request('GET', '/hello/Fabien'); $this->assertEquals('Fabien', $crawler->filter('p > span')->text()); ``` -------------------------------- ### Publisher/Distributor Database and Replication Setup Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/containers/dtc/README.md This SQL script creates the 'Sales' database, a 'Customer' table with sample data, and configures snapshot replication on the publisher/distributor instance. Ensure the password matches the one set in the environment variables. ```sql IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'Sales') CREATE DATABASE Sales GO USE Sales GO IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'Customer') CREATE TABLE Customer ( CustomerID INT PRIMARY KEY, FirstName VARCHAR(50), LastName VARCHAR(50) ) GO INSERT INTO Customer (CustomerID, FirstName, LastName) VALUES (1, 'John', 'Doe'), (2, 'Jane', 'Smith') GO -- Configure Snapshot Replication -- Ensure the password 'YourStrong!Passw0rd' is correct and matches the environment variable EXEC sp_adddistpublisher @publisher = @@SERVERNAME, @distributor = @@SERVERNAME, @directory_type = 'வாகும்' GO EXEC sp_adddistributiondb @distributor = @@SERVERNAME, @database = 'distribution' GO EXEC sp_addlogreader @publisher = @@SERVERNAME, @publication = 'Sales-SnapshotRepl', @subscriber = 'db2' GO EXEC sp_addpushsubscription_agent @joblogin = NULL, @jobpassword = NULL, @subscriber_server = 'db2', @subscriber_db = 'Sales', @publication = 'Sales-SnapshotRepl' GO ``` -------------------------------- ### Add File_Iterator Dependency with Composer Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/phpunit/php-file-iterator/README.md To install File_Iterator, add the "phpunit/php-file-iterator" package to your project's composer.json file. This example shows a minimal composer.json for version ~1.4. ```json { "require": { "phpunit/php-file-iterator": "~1.4" } } ``` -------------------------------- ### Serve Bootstrap Documentation Locally Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/databases/wide-world-importers/wwi-app/wwwroot/lib/bootstrap/README.md Run the Bootstrap documentation locally using Jekyll. This command starts a local server to preview the documentation. ```bash bundle exec jekyll serve ``` -------------------------------- ### Add PHP Text Template Dependency with Composer Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/phpunit/php-text-template/README.md To install this package as a local, per-project dependency, add it to your project's composer.json file. This example shows a minimal composer.json with the Text_Template dependency. ```json { "require": { "phpunit/php-text-template": "~1.2" } } ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/README.md Navigate to the project's 'todo' directory and run this command to install all required PHP dependencies using Composer. ```bash cd todo composer install ``` -------------------------------- ### Run Development Server Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/django/README.md Starts the Django development server to run the Bootcamp application. ```bash python manage.py runserver ``` -------------------------------- ### Start SQL Server Containers Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/containers/dtc/README.md Run this command in the directory containing the docker-compose.yml file to start the SQL Server containers for the replication demo. Note that this process may take approximately 2 minutes. ```bash docker-compose up ``` -------------------------------- ### Disable ADR and Start Transaction for Deletion Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/accelerated-database-recovery/basic_adr.ipynb Disables Accelerated Database Recovery for the WideWorldImportersDW database and then begins a transaction to delete all rows from the Fact.OrderHistory table. This setup is used to observe transaction log behavior. ```sql USE master GO ALTER DATABASE WideWorldImportersDW SET ACCELERATED_DATABASE_RECOVERY = OFF GO USE WideWorldImportersDW GO BEGIN TRAN DELETE FROM [Fact].[OrderHistory] GO ``` -------------------------------- ### Experimental Q.begin for Promise Chains Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/databases/wide-world-importers/wwi-app/wwwroot/lib/q/CHANGES.md Introduces an experimental Q.begin() function intended to initiate chains of .then calls, allowing for easier reordering of subsequent steps. ```javascript Q.begin() ``` -------------------------------- ### Get Table Space Usage Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/unicode/notebooks/Perf_Non-Latin.ipynb Calculates and displays the number of rows, used pages, total pages, and data size in megabytes for tables starting with 'Inserts%'. This provides an overview of storage consumption for the different data types. ```sql USE [UnicodeDatabase_Cyrillic]; GO SELECT OBJECT_NAME(p.OBJECT_ID) AS TableName, p.ROWS AS NumRows, a.used_pages, a.total_pages, CONVERT(DECIMAL(19,2),ISNULL(a.used_pages,0))*8/1024 AS DataSizeMB FROM sys.allocation_units a INNER JOIN sys.partitions p ON p.hobt_id = a.container_id AND OBJECT_NAME(p.OBJECT_ID) LIKE 'Inserts%' ORDER BY TableName GO ``` -------------------------------- ### Download SQL Server Installation Script Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/azure-arc-enabled-sql-server/install-payg-sql-server/README.md Use curl to download the `install-payg-sql-server.ps1` script to your current directory. This script is used to install a pay-as-you-go SQL Server instance. ```console curl https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/manage/azure-arc-enabled-sql-server/install-payg-sql-server/install-payg-sql-server.ps1 -o install-payg-sql-server.ps1 ``` -------------------------------- ### Instantiate Parser and PrettyPrinter (New) Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/nikic/php-parser/UPGRADE-1.0.md This demonstrates the recommended way to instantiate the parser and pretty printer using the new `PhpParser` namespace. Note the change from `PHPParser` to `PhpParser` and the updated class names. ```php $parser = new \PhpParser\Parser(new PhpParser\Lexer\Emulative); $prettyPrinter = new \PhpParser\PrettyPrinter\Standard; ``` -------------------------------- ### R Script for Customer Clustering Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/r-services/getting-started/customer-clustering/README.md This R script utilizes the K-means algorithm to cluster customer data. Ensure R Services is installed in SQL Server 2016 or higher. No specific setup is required beyond having the R environment ready. ```R Customer Clustering.R ``` -------------------------------- ### Find Shortest Path Within Hop Limit Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/sql-graph/ShortestPath/README.md This T-SQL query finds the shortest path from a given starting ProductID to all other reachable ProductIDs within a specified number of hops (1 to 3 in this example). It utilizes the SHORTEST_PATH function with an arbitrary length path specification. ```T-SQL DECLARE @StartNode INT = 713; -- Example: Bearing Ball SELECT STRING_AGG(Name, ' -> ') AS ShortestPath FROM ( SELECT node.ProductID, node.Name, edge.rank AS PathRank FROM (SELECT * FROM OPENJSON((SELECT @StartNode AS StartNode, 740 AS EndNode))) AS StartNode CROSS APPLY dbo.fn_SHORTEST_PATH(StartNode.StartNode, StartNode.EndNode, 1, 3) AS SP -- Specify min and max hops INNER JOIN dbo.Product AS node ON SP.node_id = node.ProductID LEFT JOIN (SELECT *, ROW_NUMBER() OVER (PARTITION BY node_id ORDER BY edge_id) as rank FROM OPENJSON((SELECT @StartNode AS StartNode, 740 AS EndNode))) AS edge ON SP.node_id = edge.node_id AND SP.edge_id = edge.edge_id ) AS Path ORDER BY PathRank; ``` -------------------------------- ### Start Existing SQL Server 2019 Demo Container Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/in-memory-database/memory-optimized-tempdb-metadata/MemoryOptmizedTempDBMetadata-Python.ipynb If the demo container name is already in use, use this command to start the existing container. This is useful if you have previously run the container and it is in a stopped state. ```python ! docker start sql2019tempdbdemo ``` -------------------------------- ### Download SQL Script for Optimized Locking Setup Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/optimized-locking/transaction-id-locking/README.md Download the T-SQL script to set up the OptimizedLocking database and configure it for the sample. Ensure the database does not already exist before execution. ```T-SQL Download [create-configure-optimizedlocking-db.sql](sql-scripts/create-configure-optimizedlocking-db.sql) T-SQL script from sql-scripts folder ``` -------------------------------- ### Install SqlServer PowerShell Module Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/sql-assessment-api/QuickStart.md Installs the SqlServer PowerShell module. Use -AllowClobber and -Force for a clean installation. Get-Module verifies the installation. ```PowerShell Install-Module -Name SqlServer -AllowClobber -Force Get-Module ``` -------------------------------- ### Configure Data Source and Initial Catalog in Program.cs Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/security/azure-active-directory-auth/token/README.md Update the 'Data Source' and 'Initial Catalog' values in your Program.cs file. Replace '' with your SQL Server name and 'demo' with your database name. ```csharp builder["Data Source"] = ".database.windows.net"; // replace with your server name builder["Initial Catalog"] = "demo"; // replace with your database name ``` -------------------------------- ### Install NuGet Package Provider Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/azure-arc-enabled-sql-server/uninstall-azure-extension-for-sql-server/README.md Install the NuGet package provider, which is required for installing PowerShell modules from the PowerShell Gallery. Specify a minimum version and scope for the installation. ```powershell Install-packageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Scope CurrentUser -Force ``` -------------------------------- ### Install Homebrew Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/tutorials/ruby/mac/README.md Use this command to install Homebrew, a package manager for macOS, which is a prerequisite for installing FreeTDS. ```bash ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ``` -------------------------------- ### Static Q.all Equivalent Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/databases/wide-world-importers/wwi-app/wwwroot/lib/q/README.md Demonstrates the static Q.all method, which is equivalent to calling .all() on a promise that resolves to an array. ```javascript return Q.all([a, b]); ``` -------------------------------- ### Start SQL Server 2019 Demo Container Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/in-memory-database/memory-optimized-tempdb-metadata/MemoryOptmizedTempDBMetadata-Python.ipynb This command starts the SQL Server 2019 demo container with specified environment variables for EULA acceptance and SA password. It maps the container's port 1433 to the host's port 1455. ```python ! docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=P@ssw0rd!" -p 1455:1433 --name sql2019tempdbdemo -d bluefooted/sql2019tempdbdemo ``` -------------------------------- ### Install PHP dotenv with Composer Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/vlucas/phpdotenv/README.md Installs the PHP dotenv library using Composer. Ensure Composer is installed first. ```shell curl -s http://getcomposer.org/installer | php php composer.phar require vlucas/phpdotenv ``` -------------------------------- ### Install random_compat using a signed PHP Archive Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/paragonie/random_compat/README.md Download the .phar and .pubkey files, optionally verify the PGP signature, and include the .phar file in your project. ```php require_once "/path/to/random_compat.phar"; ``` -------------------------------- ### Install Ruby Version Manager (RVM) Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/tutorials/ruby/linux/README.md Installs RVM, a tool for managing multiple Ruby environments. Ensure you have curl installed. ```bash sudo apt-get --assume-yes update command curl -sSL https://rvm.io/mpapis.asc | gpg --import - curl -L https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm ``` -------------------------------- ### Install Swift Mailer with Composer Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/swiftmailer/swiftmailer/doc/installing.rst Use this command to install Swift Mailer via Composer. Ensure you have Composer installed and configured. ```bash $ php composer.phar require swiftmailer/swiftmailer @stable ``` -------------------------------- ### Initialize and Run Console Application Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/symfony/console/README.md Instantiate the Application object and run it to manage CLI arguments and execute commands. ```php use Symfony\Component\Console\Application; $console = new Application(); $console->run(); ``` -------------------------------- ### Foo Bar Command Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/symfony/console/Tests/Fixtures/application_asxml1.txt A sample command for demonstration purposes. ```APIDOC ## GET /foo:bar ### Description The foo:bar command. ### Method GET ### Endpoint /foo:bar ### Response #### Success Response (200) - **message** (string) - A success message. ``` -------------------------------- ### Install phpspec Dependencies with Composer Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/phpspec/phpspec/README.rst Use these commands to download and install phpspec dependencies using Composer. Ensure you have wget and PHP installed. ```bash wget -nc http://getcomposer.org/composer.phar php composer.phar install ``` -------------------------------- ### Install PHPUnit Dependencies with Composer Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/phpunit/phpunit/CONTRIBUTING.md After cloning the repository, use Composer to install PHPUnit's dependencies. Ensure you have `composer.phar` available or installed globally. ```bash $ wget http://getcomposer.org/composer.phar $ php composer.phar install ``` -------------------------------- ### Install Pay-as-you-go SQL Server with Azure Arc Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/azure-arc-enabled-sql-server/install-payg-sql-server/README.md This PowerShell command installs a SQL Server instance, connects it to Azure using the specified subscription, resource group, and region, and configures it for pay-as-you-go licensing. Ensure the IsoFolder path is correct. ```PowerShell .\install-payg-sql-server.ps1 -AzureSubscriptionId -AzureResourceGroup -AzureRegion westus -IsoFolder C:\Users\[YourUsername]\Downloads ``` -------------------------------- ### Install Az PowerShell Module Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/azure-arc-enabled-sql-server/uninstall-azure-extension-for-sql-server/README.md Install the Azure Az PowerShell module. This module is necessary for interacting with Azure resources. It is recommended to install it for the current user. ```powershell Install-Module Az -Scope CurrentUser -Repository PSGallery -Force ``` -------------------------------- ### Example Custom Command Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/symfony/console/Tests/Fixtures/application_asxml1.txt This entry represents a custom command 'foo:bar' with no arguments or options defined in this snippet. ```bash foo:bar ``` ```bash afoobar ``` -------------------------------- ### Installation Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/symfony/debug/Resources/ext/README.md Instructions on how to compile and install the Symfony Debug Extension. ```APIDOC ## Installation The extension is compatible with ZTS mode and supports PHP versions 5.3, 5.4, 5.5, and 5.6. To enable the extension from source, run the following commands: ```bash phpize ./configure make sudo make install ``` ``` -------------------------------- ### Run Ruby SQL Sample Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/tutorials/ruby/linux/README.md Executes the main Ruby sample file after updating connection string details. ```bash ruby sample_ruby_linux.rb ``` -------------------------------- ### Run Node.js Sample Application Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/r-services/predictive-analytics/scripts/Lab.md Execute the Node.js sample application from the command line to run the prediction. Ensure you are in the directory containing TipPredictor.js. ```bash node TipPredictor.js ``` -------------------------------- ### Update Python package list and install Python development tools Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/tutorials/python/pymssql/linux/README.md Installs Python development headers and pip on Ubuntu Linux. This is a prerequisite for installing Python packages. ```bash sudo apt-get --assume-yes update sudo apt-get --assume-yes install python-dev python-pip ``` -------------------------------- ### Setup SQL Database for Product Catalog Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/features/json/product-catalog/nodejs-jquery-bootstrap-app/README.md This script sets up the Product table and necessary stored procedures for the Node.js product catalog application. Ensure your SQL Server compatibility level is set to 130 or higher. ```sql USE [master] GO CREATE DATABASE [ProductCatalog] GO ALTER DATABASE [ProductCatalog] SET COMPATIBILITY_LEVEL = 130 GO USE [ProductCatalog] GO CREATE TABLE [dbo].[Product]( [ProductID] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY, [Name] [nvarchar](50) NOT NULL, [Price] [decimal](18, 2) NOT NULL, [ProductDescription] [nvarchar](200) NULL, [ProductImage] [varbinary](max) NULL ) GO CREATE PROCEDURE [dbo].[AddProduct] @Name [nvarchar](50), @Price [decimal](18, 2), @ProductDescription [nvarchar](200) = NULL, @ProductImage [varbinary](max) = NULL AS BEGIN SET NOCOUNT ON; INSERT INTO [dbo].[Product] ([Name], [Price], [ProductDescription], [ProductImage]) VALUES (@Name, @Price, @ProductDescription, @ProductImage) SELECT SCOPE_IDENTITY() AS ProductID END GO CREATE PROCEDURE [dbo].[UpdateProduct] @ProductID [int], @Name [nvarchar](50), @Price [decimal](18, 2), @ProductDescription [nvarchar](200) = NULL, @ProductImage [varbinary](max) = NULL AS BEGIN SET NOCOUNT ON; UPDATE [dbo].[Product] SET [Name] = @Name, [Price] = @Price, [ProductDescription] = @ProductDescription, [ProductImage] = @ProductImage WHERE [ProductID] = @ProductID END GO CREATE PROCEDURE [dbo].[DeleteProduct] @ProductID [int] AS BEGIN SET NOCOUNT ON; DELETE FROM [dbo].[Product] WHERE [ProductID] = @ProductID END GO CREATE PROCEDURE [dbo].[GetAllProducts] AS BEGIN SET NOCOUNT ON; SELECT [ProductID], [Name], [Price], [ProductDescription], [ProductImage] FROM [dbo].[Product] END GO -- Sample data INSERT INTO [dbo].[Product] ([Name], [Price], [ProductDescription]) VALUES ('Laptop', 1200.00, 'High-performance laptop') INSERT INTO [dbo].[Product] ([Name], [Price], [ProductDescription]) VALUES ('Mouse', 25.50, 'Ergonomic wireless mouse') INSERT INTO [dbo].[Product] ([Name], [Price], [ProductDescription]) VALUES ('Keyboard', 75.00, 'Mechanical gaming keyboard') GO -- Stored procedure to get products as JSON CREATE PROCEDURE [dbo].[GetAllProductsJSON] AS BEGIN SET NOCOUNT ON; SELECT [ProductID] AS id, [Name] AS name, [Price] AS price, [ProductDescription] AS description FROM [dbo].[Product] FOR JSON PATH, ROOT('products') END GO ``` -------------------------------- ### Install PHP Console Highlighter with Composer Source: https://github.com/microsoft/sql-server-samples/blob/master/samples/development-frameworks/laravel/vendor/jakub-onderka/php-console-highlighter/README.md Use this JSON configuration in your composer.json file to require the PHP Console Highlighter library. Run 'php composer.phar install' to install it. ```json { "require": { "jakub-onderka/php-console-highlighter": "0.*" } } ```