<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SQL Database Archives - AzureOps</title>
	<atom:link href="https://azureops.org/articles/category/azure/sql-database/feed/" rel="self" type="application/rss+xml" />
	<link>https://azureops.org/articles/category/azure/sql-database/</link>
	<description>Notable things about Cloud, Data and DevOps.</description>
	<lastBuildDate>Fri, 03 Apr 2026 11:04:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/azureops.org/wp-content/uploads/2021/04/cropped-android-chrome-512x512-1.png?fit=32%2C32&#038;ssl=1</url>
	<title>SQL Database Archives - AzureOps</title>
	<link>https://azureops.org/articles/category/azure/sql-database/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">190208641</site>	<item>
		<title>Compare Azure SQL Database Schema Using sqlpackage</title>
		<link>https://azureops.org/articles/compare-azure-sql-database-schema-using-sqlpackage/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Sat, 10 Jan 2026 19:16:23 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=9188</guid>

					<description><![CDATA[<p>Learn how to compare two Azure SQL Database Schema effectively and generate delta scripts for seamless deployment.</p>
<p>The post <a href="https://azureops.org/articles/compare-azure-sql-database-schema-using-sqlpackage/">Compare Azure SQL Database Schema Using sqlpackage</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">When working with Azure SQL Databases, it is quite common to have multiple environments such as <strong>Dev</strong>, <strong>Test</strong>, <strong>UAT</strong>, and <strong>Production</strong>. Over time, schema drift between these environments becomes inevitable. Before deploying changes to production, it is critical to understand <em>exactly</em> what is different and what will change.</p>



<p class="">In this article, we will see how to <strong>compare Azure SQL database schema using <code>sqlpackage.exe</code></strong> and generate a <strong>delta script</strong> that shows the differences in a controlled and repeatable way. The approach and flow are similar to the DACPAC-based comparison strategy discussed earlier on AzureOps.</p>



<h2 class="wp-block-heading">Why use sqlpackage for database comparison?</h2>



<p class=""><code><a href="https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage?view=sql-server-ver17" target="_blank" rel="noreferrer noopener">sqlpackage.exe</a></code> is a command-line utility provided by Microsoft that works with <strong>DACPAC</strong> and <strong>BACPAC</strong> files. Using <code>sqlpackage</code>, you can:</p>



<ul class="wp-block-list">
<li class="">Compare two databases using DACPACs</li>



<li class="">Generate a deployment (delta) script</li>



<li class="">Control destructive changes explicitly</li>



<li class="">Automate comparisons in CI/CD pipelines</li>
</ul>



<p class="">For Azure SQL Database scenarios, this method is especially useful when direct schema comparison tools are not available or when automation is required.</p>



<h2 class="wp-block-heading">Creating a DACPAC</h2>



<p class="">To compare database schemas using <code>sqlpackage</code>, you first need a <strong>DACPAC</strong> file, which represents the database schema.</p>



<p class="">You can create a DACPAC using <strong>sqlpackage.exe</strong>, <strong>SSMS</strong>, or <strong>Visual Studio</strong>. For a quick, step-by-step guide covering all methods, refer to this <a href="https://azureops.org/articles/dacpac-sql-server-database/?utm_source=chatgpt.com" target="_blank" rel="noreferrer noopener">article</a>.</p>



<h2 class="wp-block-heading">Installing <code>sqlpackage</code> Before You Begin</h2>



<p class="">Before you can compare two Azure SQL database schemas using <code>sqlpackage</code>, you need to <strong>install the <code>sqlpackage</code> command-line utility</strong> on your machine. <code>sqlpackage.exe</code> is the same tool that Powers the DACPAC deployments discussed in this site’s previous article on deploying DACPACs to Azure SQL Database.</p>



<p class="">Here are the recommended ways to install <code>sqlpackage</code>, depending on your environment:</p>



<h3 class="wp-block-heading">Option 1 — Install as a .NET Global Tool (Cross-Platform)</h3>



<p class="">The easiest and most modern way to install <code>sqlpackage</code> on <strong>Windows, macOS, or Linux</strong> is using the <strong>.NET SDK tool installer</strong>. This gives you the <code>sqlpackage</code> command directly on your PATH. Run below command in command prompt.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; gutter: false; title: ; notranslate">
dotnet tool install --global Microsoft.SqlPackage
</pre></div>


<p class="">If you already have it installed and want to update to the latest version, run:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; gutter: false; title: ; notranslate">
dotnet tool update --global Microsoft.SqlPackage
</pre></div>


<p class="">This method works well for local development and automation scripts, including PowerShell and CI/CD pipelines.</p>



<h3 class="wp-block-heading">Option 2 — Download Standalone Zip (Windows / macOS / Linux)</h3>



<p class="">If you don’t use the .NET SDK or prefer a <strong>self-contained download</strong>, Microsoft also publishes standalone builds of <code>sqlpackage</code>:</p>



<ol class="wp-block-list">
<li class="">Visit the official SqlPackage<a href="https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage-download?view=sql-server-ver17" target="_blank" rel="noreferrer noopener"> download page</a> on Microsoft Docs.</li>



<li class="">Download the appropriate zip for your OS.</li>



<li class="">Extract and place the folder somewhere on your system (e.g., <code>C:\tools\sqlpackage</code>).</li>



<li class="">Add the folder containing <code>sqlpackage.exe</code> to your system PATH so you can call it from any terminal.</li>
</ol>



<p class="">This method is useful if you want to avoid installing .NET tools or need to bundle <code>sqlpackage</code> with deployment scripts.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?ssl=1"><img fetchpriority="high" decoding="async" width="1090" height="420" data-attachment-id="9206" data-permalink="https://azureops.org/articles/compare-azure-sql-database-schema-using-sqlpackage/image-46/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?fit=1090%2C420&amp;ssl=1" data-orig-size="1090,420" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?fit=1090%2C420&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?fit=1090%2C420&amp;ssl=1" alt="compare Azure SQL Database Schema" class="wp-image-9206" style="width:809px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?w=1090&amp;ssl=1 1090w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?resize=300%2C116&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?resize=768%2C296&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?resize=450%2C173&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?resize=600%2C231&amp;ssl=1 600w" sizes="(max-width: 1090px) 100vw, 1090px" /></a></figure>



<h2 class="wp-block-heading">High-level approach</h2>



<p class="">The comparison process consists of three simple steps:</p>



<ol class="wp-block-list">
<li class="">Export both Azure SQL databases to DACPAC files</li>



<li class="">Use <code>sqlpackage.exe</code> with <code>/Action:Script</code></li>



<li class="">Review the generated delta script before applying it</li>
</ol>



<p class="">In this article, we focus on <strong>step 2</strong>, assuming you already have DACPAC files for both databases.</p>



<h2 class="wp-block-heading">Sample scenario</h2>



<p class="">Let us assume the following setup:</p>



<ul class="wp-block-list">
<li class=""><strong>Source (baseline)</strong> database: <code>sales-test-db</code></li>



<li class=""><strong>Target (to be aligned)</strong> database: <code>sales-prod-db</code></li>
</ul>



<p class="">Our goal is to compare Azure SQL Database schema and generate a SQL script that shows what changes are required to make <strong>Production</strong> match <strong>Test</strong>.</p>



<h2 class="wp-block-heading">Sample sqlpackage command</h2>



<p class="">Below is a sample <code>sqlpackage.exe</code> command to compare two DACPAC files and generate a delta script.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
sqlpackage.exe ^
  /Action:Script ^
  /SourceFile:&quot;C:\Dacpacs\sales-test-db.dacpac&quot; ^
  /TargetFile:&quot;C:\Dacpacs\sales-prod-db.dacpac&quot; ^
  /TargetDatabaseName:&quot;sales-prod-db&quot; ^
  /OutputPath:&quot;C:\Dacpacs\sales_test_vs_prod_delta.sql&quot; ^
  /p:DropObjectsNotInSource=True

</pre></div>


<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?ssl=1"><img decoding="async" width="1153" height="221" data-attachment-id="9192" data-permalink="https://azureops.org/articles/compare-azure-sql-database-schema-using-sqlpackage/sqlpackage-to-compare-azure-sql-database-schema/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?fit=1153%2C221&amp;ssl=1" data-orig-size="1153,221" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="sqlpackage to compare azure sql database schema" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?fit=1153%2C221&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?fit=1153%2C221&amp;ssl=1" alt="compare Azure SQL Database Schema using sqlpackage utility" class="wp-image-9192" style="aspect-ratio:5.217492752598458;width:881px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?w=1153&amp;ssl=1 1153w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?resize=300%2C58&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?resize=768%2C147&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?resize=450%2C86&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?resize=600%2C115&amp;ssl=1 600w" sizes="(max-width: 1153px) 100vw, 1153px" /></a></figure>



<p class="">In case you want to use PowerShell ISE, you can use below script.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: powershell; title: ; notranslate">
# Path to sqlpackage.exe
$sqlPackagePath = &quot;C:\Program Files\Microsoft SQL Server\160\DAC\bin\sqlpackage.exe&quot;

# DACPAC paths
$SourceDacpacPath = &quot;C:\Dacpacs\sales-test-db.dacpac&quot;
$TargetDacpacPath = &quot;C:\Dacpacs\sales-prod-db.dacpac&quot;

# Target database name
$TargetDatabaseName = &quot;sales-prod-db&quot;

# Output script path
$OutputScriptPath = &quot;C:\Dacpacs\sales_test_vs_prod_delta.sql&quot;

# Publish options
$DropObjectsNotInSource = &quot;True&quot;

# Execute sqlpackage
&amp; $sqlPackagePath `
    /Action:Script `
    /SourceFile:$SourceDacpacPath `
    /TargetFile:$TargetDacpacPath `
    /TargetDatabaseName:$TargetDatabaseName `
    /OutputPath:$OutputScriptPath `
    /p:DropObjectsNotInSource=$DropObjectsNotInSource

</pre></div>


<p class="">This command does <strong>not</strong> apply any changes. It only generates a SQL script that you can review and execute manually if needed.</p>



<h2 class="wp-block-heading">Understanding each parameter</h2>



<p class="">Let us break down all the parameters used in the command.</p>



<p class=""><strong>/Action:Script</strong></p>



<p class="">Specifies that <code>sqlpackage</code> should <strong>generate a deployment script</strong> instead of publishing changes directly to a database. This is the safest option when comparing environments like Test and Production.</p>



<p class=""><strong>/SourceFile</strong></p>



<p class="">Path to the <strong>source DACPAC</strong> file. This represents the <em>desired state</em> of the database.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
/SourceFile:&quot;C:\Dacpacs\sales-test-db.dacpac&quot;
</pre></div>


<p class="">In our example, the Test database schema is treated as the source of truth.</p>



<p class=""><strong>/TargetFile</strong></p>



<p class="">Path to the <strong>target DACPAC</strong> file. This represents the database you want to compare against.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
/TargetFile:&quot;C:\Dacpacs\sales-prod-db.dacpac&quot;
</pre></div>


<p class="">The generated script will contain changes required to make the target match the source.</p>



<p class=""><strong>/TargetDatabaseName</strong></p>



<p class="">Logical name of the target database.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
/TargetDatabaseName:&quot;sales-prod-db&quot;
</pre></div>


<p class="">This parameter is mandatory for the <code>Script</code> action, even when you are comparing DACPAC-to-DACPAC.</p>



<p class=""><strong>/OutputPath</strong></p>



<p class="">Specifies where the generated delta script should be written.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
/OutputPath:&quot;C:\Dacpacs\sales_test_vs_prod_delta.sql&quot;
</pre></div>


<p class="">Always review this script carefully before executing it in Production.</p>



<p class=""><strong>/p:DropObjectsNotInSource</strong></p>



<p class="">Controls whether objects that exist in the target but not in the source should be dropped.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
/p:DropObjectsNotInSource=True
</pre></div>


<ul class="wp-block-list">
<li class=""><code>True</code> – Generates <code>DROP</code> statements for extra objects in the target</li>



<li class=""><code>False</code> – Preserves objects that exist only in the target</li>
</ul>



<p class="">⚠️ <strong>Use this option with caution</strong>, especially for Production databases.</p>



<h2 class="wp-block-heading">Common additional publish parameters</h2>



<p class="">Depending on your requirements, you may also consider these commonly used parameters:</p>



<ul class="wp-block-list">
<li class=""><code>/p:BlockOnPossibleDataLoss=False</code></li>



<li class=""><code>/p:IgnorePermissions=True</code></li>



<li class=""><code>/p:IgnoreRoleMembership=True</code></li>



<li class=""><code>/p:ExcludeObjectTypes=Users;Logins</code></li>



<li class=""><code>/p:ExcludeSchemaValidation=True</code></li>
</ul>



<p class="">These options help fine-tune the comparison and avoid unwanted differences.</p>



<h2 class="wp-block-heading">Best practices</h2>



<ul class="wp-block-list">
<li class="">Always generate a script first (<code>/Action:Script</code>)</li>



<li class="">Review the delta script line by line</li>



<li class="">Never auto-apply changes to Production without validation</li>



<li class="">Store DACPACs and scripts in source control</li>



<li class="">Use the same approach in CI/CD pipelines for consistency</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="">Comparing two Azure SQL databases using <code>sqlpackage.exe</code> is a reliable and automation-friendly approach. By working with DACPAC files and generating delta scripts, you gain full visibility and control over schema changes before they reach Production.</p>



<p class="">This method fits well into modern DevOps workflows and provides a safe alternative to manual or GUI-based comparisons.</p>



<p class="">If you regularly manage schema changes across multiple environments, <code>sqlpackage</code> should be a core part of your database deployment tool.</p>



<p class="has-light-green-cyan-background-color has-background"><strong>Pro tips</strong><br>1. If you want to generate BACPAC file of an Azure SQL database, you can refer to this <a href="https://azureops.org/articles/bacpac-large-sql-server-database/" target="_blank" rel="noreferrer noopener">post</a></p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/8YVrxCgdiIg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
<p>The post <a href="https://azureops.org/articles/compare-azure-sql-database-schema-using-sqlpackage/">Compare Azure SQL Database Schema Using sqlpackage</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">9188</post-id>	</item>
		<item>
		<title>Cross Database Query in Azure SQL Database</title>
		<link>https://azureops.org/articles/cross-database-query-in-azure-sql/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Wed, 05 Nov 2025 16:25:27 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[cross database access in azure sql]]></category>
		<category><![CDATA[elastic query in azure sql]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8505</guid>

					<description><![CDATA[<p>In modern cloud architectures, it&#8217;s common to distribute data across multiple Azure SQL Databases. While this promotes modularity and scalability, it can pose challenges when you need to access data across these databases. Fortunately, Azure SQL&#8217;s external tables feature allows for seamless cross-database querying without data duplication. This feature is also known as Elastic Query [&#8230;]</p>
<p>The post <a href="https://azureops.org/articles/cross-database-query-in-azure-sql/">Cross Database Query in Azure SQL Database</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In modern cloud architectures, it&#8217;s common to distribute data across multiple Azure SQL Databases. While this promotes modularity and scalability, it can pose challenges when you need to access data across these databases. Fortunately, Azure SQL&#8217;s external tables feature allows for seamless cross-database querying without data duplication. This feature is also known as <a href="https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-query-overview?view=azuresql" target="_blank" rel="noreferrer noopener">Elastic Query</a> in Azure SQL database.This guide walks you through setting up cross database query in Azure SQL to reference a table from another Azure SQL Database, ensuring secure and efficient data access.</p>



<h3 class="wp-block-heading">Use Case &#8211; Imagine this scenario:</h3>



<ul class="wp-block-list">
<li>You have a <strong>main transactional database</strong> named <code>app-db</code> hosted on Azure SQL Server <code>app-db.database.windows.net</code>.</li>



<li>You also have a <strong>reference or lookup database</strong> named <code>source-db</code>, hosted on a separate Azure SQL Server: <code>source-server.database.windows.net</code>.</li>
</ul>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?ssl=1"><img data-recalc-dims="1" decoding="async" width="1536" height="1024" data-attachment-id="8572" data-permalink="https://azureops.org/articles/cross-database-query-in-azure-sql/elastic-query-access-in-azure-sql-database-2/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?fit=1536%2C1024&amp;ssl=1" data-orig-size="1536,1024" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Elastic query access in Azure SQL database" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?fit=1200%2C800&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?resize=1536%2C1024&#038;ssl=1" alt="Cross database query in Azure SQL database" class="wp-image-8572" style="width:616px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?w=1536&amp;ssl=1 1536w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?resize=300%2C200&amp;ssl=1 300w" sizes="(max-width: 1536px) 100vw, 1536px" /></a></figure>



<p>You want your <code>app-db</code> to query the table <code>dbo.external_table</code> from the <code>source-db</code> — without importing or copying the data. The goal is to enable live, read-only access to shared reference data across databases in a secure and manageable way.</p>



<p class="has-pale-cyan-blue-background-color has-background"><strong>Prerequisites</strong><br>Before diving into the setup, ensure the following:<br><strong>1. Azure SQL Databases</strong>: Both the source and target databases should be Azure SQL Databases.<br><strong>2. Same Region</strong>: Ensure both databases are in the same Azure region to minimize latency.<br><strong>3. User Credentials</strong>: A SQL user say (<code>ext_table_user</code>) must exist in the source database with the necessary permissions to access the target table.</p>



<h3 class="wp-block-heading">Why Create Separate user in the Source Database?</h3>



<p>The <code>ext_table_user</code> is a SQL user in the source database that the target database uses to authenticate and access data. This user must have the necessary permissions (e.g., <code>SELECT</code>) on the target table.</p>



<p>Creating a dedicated user for external access enhances security by allowing you to:</p>



<ul class="wp-block-list">
<li><strong>Limit Permissions</strong>: Grant only the necessary permissions to this user.</li>



<li><strong>Monitor Access</strong>: Track and audit activities performed by this user.</li>



<li><strong>Revoke Access Easily</strong>: If needed, you can revoke this user&#8217;s access without affecting other users.</li>
</ul>



<p>Fow these <a href="https://azureops.org/articles/grant-access-to-azure-sql-database/" target="_blank" rel="noreferrer noopener">steps </a>to how to grant access to Azure SQL database. </p>



<h2 class="wp-block-heading">How to Setup Cross Database Access in Azure SQL</h2>



<p>Follow the below quick steps to setup cross database access in Azure SQL database.</p>



<h3 class="wp-block-heading">Step 1: Create a Master Key in the Target Database</h3>



<p>The master key is essential for encrypting credentials used in external data sources.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Execute in the target database

CREATE MASTER KEY ENCRYPTION BY PASSWORD = &#039;YourStrongPasswordHere&#039;;
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Skip this if <code>SELECT * FROM sys.symmetric_keys WHERE name = '##MS_DatabaseMasterKey##'</code> already returns a row.</p>
</blockquote>



<h3 class="wp-block-heading">Step 2: Create a Database Scoped Credential</h3>



<p>This credential will be used to authenticate against the source database.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Execute in the target database

CREATE DATABASE SCOPED CREDENTIAL ext_table_user
WITH IDENTITY = &#039;ext_table_user&#039;,
     SECRET = &#039;ActualPasswordOfExtTableUser&#039;;
</pre></div>


<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h3 class="wp-block-heading">Step 3: Define the External Data Source</h3>



<p>This step establishes a connection to the source database.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Execute in the target database

CREATE EXTERNAL DATA SOURCE LinkedAzureSQLDB
WITH (
    TYPE = RDBMS,
    LOCATION = &#039;source-server.database.windows.net&#039;,
    DATABASE_NAME = &#039;source-db&#039;,
    CREDENTIAL = ext_table_user
);
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><em>Ensure</em>: Replace <code>'source-server.database.windows.net'</code> and <code>'source-db'</code> with your actual server and database names.</p>
</blockquote>



<h3 class="wp-block-heading">Step 4: Create the External Table</h3>



<p>Now, define the external table in the target database to reference the table in the source database.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Execute in the target database

CREATE EXTERNAL TABLE dbo.external_table (
    &#x5B;ID] NUMERIC(18, 0) NOT NULL,
    &#x5B;list_id] INT NOT NULL,
    &#x5B;type_id] INT NOT NULL,
    &#x5B;description] VARCHAR(50) NULL
)
WITH (
    DATA_SOURCE = LinkedAzureSQLDB,
    SCHEMA_NAME = &#039;dbo&#039;,
    OBJECT_NAME = &#039;external_table&#039;
);
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><em>Note</em>: The schema and object names should match those in the source database.</p>
</blockquote>



<h3 class="wp-block-heading">Step 5: Query the External Table</h3>



<p>With the setup complete, you can now query the external table as if it were local:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Execute in the target database

SELECT TOP 10 * FROM dbo.external_table;
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><em>Performance Tip</em>: Monitor query performance, as cross-database queries may have higher latency.</p>
</blockquote>



<p class="has-background" style="background-color:#bcefca"><strong>Pro tips:</strong><br><strong>1. Use Managed Identities</strong>: For enhanced security, consider using Azure Managed Identities instead of SQL authentication.<br>2. <strong>Monitor Performance</strong>: Regularly monitor the performance of cross-database queries to ensure they meet your application&#8217;s requirements.<br>3. <strong>Secure Credentials</strong>: Store sensitive information, like passwords, securely using Azure Key Vault.<br>4. <strong>Elastic query</strong> feature in Azure SQL is still in preview.</p>



<p>By following this guide, you can efficiently set up cross databse query in Azure SQL, enabling seamless cross-database querying while maintaining security and performance.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/8YVrxCgdiIg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
<p>The post <a href="https://azureops.org/articles/cross-database-query-in-azure-sql/">Cross Database Query in Azure SQL Database</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8505</post-id>	</item>
		<item>
		<title>SSMS 21 Copilot: Here&#8217;s How It Works</title>
		<link>https://azureops.org/articles/ssms-21-copilot/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Sat, 11 Oct 2025 08:59:10 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Microsoft Copilot]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SSMS]]></category>
		<category><![CDATA[SSMS with Copilot]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8592</guid>

					<description><![CDATA[<p>SQL Server Management Studio (SSMS) version 21 introduces native Copilot integration, enhancing SQL development. Users can connect to Azure OpenAI for efficient query generation and debugging in read-only mode. Copilot aids in writing, fixing, and optimizing SQL queries without executing modifications, ensuring control and security over data.</p>
<p>The post <a href="https://azureops.org/articles/ssms-21-copilot/">SSMS 21 Copilot: Here&#8217;s How It Works</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">SQL Server Management Studio (SSMS) has been a staple for database professionals for years. With version 21, Microsoft has added something many users have been waiting for: <strong>native Copilot integration</strong>. No extensions, no hacks—just open it up, connect to Azure, and start working smarter. Here’s a walkthrough of the most important features SSMS 21 Copilot offers and how they work in practice.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class=""><em>You write the query, run it, catch a missing condition, tweak the join, test again—repeat until it’s right. SSMS 21 brings Copilot into that loop. </em></p>
</blockquote>



<h2 class="wp-block-heading"><strong>TL;DR:</strong></h2>



<ul class="wp-block-list">
<li class="">SSMS 21 now includes <strong>built-in Copilot</strong>—no extensions. Just require connection to your <strong>Azure OpenAI deployment</strong> (like GPT-4o).</li>



<li class="">Works only with <strong>SQL Server connections</strong> (not SSIS, SSAS, or SSRS).</li>



<li class="">Runs in <strong>read-only mode</strong>—won’t execute any DML or modify data.</li>



<li class="">Can <strong>generate queries</strong>, fix broken SQL, and suggest optimizations.</li>



<li class="">Supports prompts like: “fix this query,” “optimize for performance,” or “generate insert script.”</li>



<li class="">Ideal for SQL developers who want help writing, debugging, or learning better query patterns—without giving up control.</li>
</ul>



<h2 class="wp-block-heading">Installation: Copilot Comes Built-in</h2>



<p class="">The installer for <a href="https://learn.microsoft.com/en-us/ssms/install/install" target="_blank" rel="noreferrer noopener">SSMS 21</a> clearly shows that Copilot is not an afterthought—it’s front and center. Once you launch the installer, you&#8217;ll notice the <strong>&#8220;Copilot Integration&#8221;</strong> checkbox enabled by default. This means no manual setup is required post-install. It&#8217;s part of the core experience now.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?ssl=1"><img loading="lazy" decoding="async" width="1258" height="705" data-attachment-id="8595" data-permalink="https://azureops.org/articles/ssms-21-copilot/ssms-21-installation-with-copilot/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?fit=1258%2C705&amp;ssl=1" data-orig-size="1258,705" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SSMS 21 installation with copilot" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?fit=1200%2C672&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?fit=1200%2C672&amp;ssl=1" alt="ssms 21 copilot installation" class="wp-image-8595" style="width:793px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?w=1258&amp;ssl=1 1258w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=300%2C168&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=1200%2C672&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=1106%2C620&amp;ssl=1 1106w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=768%2C430&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=450%2C252&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=600%2C336&amp;ssl=1 600w" sizes="(max-width: 1258px) 100vw, 1258px" /></a></figure>



<h3 class="wp-block-heading">First Run: Setting Up Your Azure OpenAI Keys</h3>



<p class="">Once SSMS launches, you’ll be prompted to connect Copilot to your <strong>Azure OpenAI</strong> setup.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?ssl=1"><img loading="lazy" decoding="async" width="1086" height="778" data-attachment-id="8596" data-permalink="https://azureops.org/articles/ssms-21-copilot/enter-open-ai-service-key/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?fit=1086%2C778&amp;ssl=1" data-orig-size="1086,778" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="enter open ai service key" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?fit=1086%2C778&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?fit=1086%2C778&amp;ssl=1" alt="ssms 21 copilot installation - seeting up openai details" class="wp-image-8596" style="width:718px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?w=1086&amp;ssl=1 1086w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?resize=300%2C215&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?resize=865%2C620&amp;ssl=1 865w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?resize=768%2C550&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?resize=450%2C322&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?resize=600%2C430&amp;ssl=1 600w" sizes="(max-width: 1086px) 100vw, 1086px" /></a></figure>



<p class="">In the first prompt, you’ll be asked to provide:</p>



<ul class="wp-block-list">
<li class="">Azure OpenAI service endpoint</li>



<li class="">Azure OpenAI deployment</li>



<li class="">Azure OpenAI API key</li>
</ul>



<p class="">If you haven’t already created this in Azure, it’s a quick process: deploy a model, generate a key, and you’re good to go. we see how this information is pasted into SSMS.</p>



<p class="">It’s a one-time step, and once entered, Copilot starts responding instantly within SSMS.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?ssl=1"><img loading="lazy" decoding="async" width="996" height="523" data-attachment-id="8601" data-permalink="https://azureops.org/articles/ssms-21-copilot/keys-and-endpoint-3/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?fit=996%2C523&amp;ssl=1" data-orig-size="996,523" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="keys and endpoint" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?fit=996%2C523&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?fit=996%2C523&amp;ssl=1" alt="Create open ai service and get openai endpoint and key." class="wp-image-8601" style="width:802px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?w=996&amp;ssl=1 996w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?resize=300%2C158&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?resize=768%2C403&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?resize=450%2C236&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?resize=600%2C315&amp;ssl=1 600w" sizes="(max-width: 996px) 100vw, 996px" /></a></figure>



<p class="">To get an Azure <strong>OpenAI deployment </strong>name for SSMS Copilit, we need Gen AI model. That’s the engine powering your Copilot. GPT-4o is optimized for speed and real-time interaction, making it well-suited for something as dynamic as SQL writing and analysis.</p>



<p class="">If you already use GPT-based models in Azure, you can reuse the same deployment. If not, create a new one and pick GPT-4o or other depending on availability.</p>



<h2 class="wp-block-heading">Which Connections Are Supported?</h2>



<p class="">As of now, <strong>Copilot in SSMS works only with SQL Server connections</strong>—whether it&#8217;s a local database or Azure SQL.</p>



<p class="">It does <strong>not</strong> support:</p>



<ul class="wp-block-list">
<li class="">SQL Server Integration Services (SSIS)</li>



<li class="">SQL Server Analysis Services (SSAS)</li>



<li class="">SQL Server Reporting Services (SSRS)</li>
</ul>



<p class="">So if you’re connected to an SSIS or SSAS instance, you won’t see Copilot suggestions. It’s focused purely on <strong>Transact-SQL (T-SQL)</strong> scenarios for now.</p>



<h3 class="wp-block-heading">Read-Only Mode – No Live Data Changes</h3>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class=""><em>Copilot works in a read-only mode inside SSMS</em> for GOOD.</p>
</blockquote>



<p class="">It will <strong>not execute updates, deletes, or any data-modifying queries</strong> on its own. It doesn’t have permissions to alter databases or run DML commands. You remain in full control.</p>



<p class="">That said, it <strong>can generate</strong> update, insert, and delete queries for you, which you can review, tweak, and run manually. This helps reduce the risk of accidental changes while still speeding up development.</p>



<h2 class="wp-block-heading">Quick Demo: Fixing a Broken Query</h2>



<p class="">I pasted a malformed SELECT query into SSMS. Copilot immediately offered a fix and even explained what was wrong.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?ssl=1"><img loading="lazy" decoding="async" width="1332" height="277" data-attachment-id="8604" data-permalink="https://azureops.org/articles/ssms-21-copilot/fix-sql-query-in-ssms-using-copilot/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?fit=1332%2C277&amp;ssl=1" data-orig-size="1332,277" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Fix SQL Query in SSMS using copilot" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?fit=1200%2C250&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?fit=1200%2C250&amp;ssl=1" alt="SSMS 21 Copilot" class="wp-image-8604" style="width:1023px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?w=1332&amp;ssl=1 1332w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?resize=300%2C62&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?resize=1200%2C250&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?resize=768%2C160&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?resize=450%2C94&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?resize=600%2C125&amp;ssl=1 600w" sizes="(max-width: 1332px) 100vw, 1332px" /></a></figure>



<h3 class="wp-block-heading">Few Prompt Examples: Result Accuracy</h3>



<p class="">In below example, we asked Copilot to generate a complex query involving filters, aggregates, and joins. The result was accurate and ready to run with minimal edits.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?ssl=1"><img loading="lazy" decoding="async" width="1591" height="968" data-attachment-id="8607" data-permalink="https://azureops.org/articles/ssms-21-copilot/result-1/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?fit=1591%2C968&amp;ssl=1" data-orig-size="1591,968" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="result 1" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?fit=1200%2C730&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?fit=1200%2C730&amp;ssl=1" alt="SSMS 21 Copilot" class="wp-image-8607" style="width:890px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?w=1591&amp;ssl=1 1591w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=300%2C183&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=1200%2C730&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=1019%2C620&amp;ssl=1 1019w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=768%2C467&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=1536%2C935&amp;ssl=1 1536w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=450%2C274&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=600%2C365&amp;ssl=1 600w" sizes="(max-width: 1591px) 100vw, 1591px" /></a></figure>



<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<p class=""> the same query was further optimized by Copilot after being prompted with: <em>&#8220;Make it efficient.&#8221;</em> It introduced indexing suggestions and added a <code>WITH (NOLOCK)</code> hint—something even experienced developers can forget.</p>



<p class="">In another example, we asked Copilot another question on a different query context (another database connection), and it just worked fine.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?ssl=1"><img loading="lazy" decoding="async" width="674" height="275" data-attachment-id="8608" data-permalink="https://azureops.org/articles/ssms-21-copilot/result-2/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?fit=674%2C275&amp;ssl=1" data-orig-size="674,275" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="result 2" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?fit=674%2C275&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?fit=674%2C275&amp;ssl=1" alt="SSMS 21 Copilot" class="wp-image-8608" style="width:575px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?w=674&amp;ssl=1 674w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?resize=300%2C122&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?resize=450%2C184&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?resize=600%2C245&amp;ssl=1 600w" sizes="(max-width: 674px) 100vw, 674px" /></a></figure>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class=""><em>These examples show that Copilot isn’t just copying boilerplate SQL—it understands context and best practices.</em></p>
</blockquote>



<h2 class="wp-block-heading">Should You Use This?</h2>



<p class="">If your daily work involves writing or reading SQL, then yes—this is probably the most useful update to SSMS in years.</p>



<p class="">Here’s what it helps with:</p>



<ul class="wp-block-list">
<li class="">Writing long queries faster</li>



<li class="">Understanding joins and filters</li>



<li class="">Fixing syntax issues</li>



<li class="">Learning better SQL patterns</li>



<li class="">Generating stored procedure templates</li>



<li class="">Drafting DML scripts (but not running them automatically)</li>
</ul>



<h2 class="wp-block-heading">What It Won’t Do (Yet)</h2>



<p class="">Let’s be clear:</p>



<ul class="wp-block-list">
<li class="">It won’t <strong>connect to SSIS/SSAS/SSRS</strong></li>



<li class="">It won’t <strong>execute anything that modifies data</strong></li>



<li class="">It won’t <strong>automatically run</strong> DDL/ DML code it suggests</li>
</ul>



<p class="">This is intentional, for safety and audit reasons. Think of it as a smart assistant—not a trigger-happy automation engine.</p>



<h2 class="wp-block-heading">A Note on Privacy and Control</h2>



<p class="">Copilot integrates directly with your Azure environment, so you control what it accesses and shares. It processes your prompts and data securely within your subscription. According to Microsoft, it doesn&#8217;t store any query logs outside your environment, which helps meet compliance requirements for enterprise users.</p>



<p class="">SSMS 21 doesn’t just add Copilot—it integrates it naturally into the flow of writing, editing, and reviewing SQL. It’s fast, context-aware, and doesn’t get in the way.</p>



<p class="has-background" style="background-color:#beefca"><strong>Pro tips:</strong><br>1. While it&#8217;s good to have Copilot like features in SSMS 21, it seems to have lost some very important features like Import Export Wizard for databases like Azure SQL.<br>2. <a href="https://azureops.org/articles/data-agent-in-microsoft-fabric-heres-how-it-works/" target="_blank" rel="noreferrer noopener">Learn</a> how to build data agent in Microsoft Fabric.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/ssms-21-copilot/">SSMS 21 Copilot: Here&#8217;s How It Works</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8592</post-id>	</item>
		<item>
		<title>Deploy DACPAC to Azure SQL Database</title>
		<link>https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Wed, 01 Jan 2025 07:56:13 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[dacpac]]></category>
		<category><![CDATA[dacpac sql server]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8224</guid>

					<description><![CDATA[<p>This guide will walk you through the process of deploy DACPAC to Azure SQL database directly from Visual Studio. </p>
<p>The post <a href="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/">Deploy DACPAC to Azure SQL Database</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">Deploying a DACPAC to an Azure SQL Database is a critical step in ensuring your database changes are effectively moved from development to production. This guide will walk you through the process of deploy DACPAC to Azure SQL database directly from Visual Studio. </p>



<p class="has-pale-cyan-blue-background-color has-background"><strong>Prerequisites:</strong><br>1. <a href="https://visualstudio.microsoft.com/downloads/" target="_blank" rel="noreferrer noopener">Visual Studio</a> with data tools installed on your system.<br>2. An Azure SQL Database set up and accessible.<br>3. A DACPAC file ready for deployment.</p>



<h2 class="wp-block-heading">Create a DACPAC File</h2>



<p class="">In this <a href="https://azureops.org/articles/dacpac-sql-server-database/" target="_blank" rel="noreferrer noopener">post</a>, we cover the process of creating a DACPAC file, a critical artifact that encapsulates the schema and objects of a SQL Server database. Learn how to build and validate your DACPAC files to ensure seamless deployments.</p>



<h2 class="wp-block-heading">Open a DACPAC File in Visual Studio</h2>



<p class="">Discover how to open and inspect a DACPAC file in Visual Studio. This <a href="https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/" target="_blank" rel="noreferrer noopener">guide </a>provides details of how to open DACPAC file in Visual Studio.</p>



<h2 class="wp-block-heading">Deploy DACPAC to Azure SQL Database from Visual Studio</h2>



<p class="">Follow the below steps to deploy the DACPAC project from visual Studio. You can follow the same below steps to deploy database project to any SQL Server database or Azure Managed Instance. Make sure to select correct target platform and provide applicable connection details.</p>



<h4 class="wp-block-heading">1. Open Visual Studio</h4>



<ol start="1" class="wp-block-list">
<li class="">Launch Visual Studio and open your solution or project.</li>



<li class="">Ensure you have the <strong>SQL Server Data Tools (SSDT)</strong> installed.</li>
</ol>



<h4 class="wp-block-heading">2. Change target platform of database project</h4>



<ol class="wp-block-list">
<li class="">Right-click on database project and click properties. </li>



<li class="">Change the Target platform to Microsoft Azure SQL Database as shown in the below image. </li>
</ol>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="753" height="203" data-attachment-id="8247" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/image-28/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?fit=753%2C203&amp;ssl=1" data-orig-size="753,203" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?fit=753%2C203&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?resize=753%2C203&#038;ssl=1" alt="Change target platform of SQL database project. " class="wp-image-8247" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?w=753&amp;ssl=1 753w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?resize=300%2C81&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?resize=450%2C121&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?resize=600%2C162&amp;ssl=1 600w" sizes="(max-width: 753px) 100vw, 753px" /></a></figure>



<h4 class="wp-block-heading">3. Publish the Database Project</h4>



<p class="">Right-click on the project and select <strong>Publish</strong> from the context menu.</p>



<p class="">In <strong>Solution Explorer</strong>, locate your database project.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="555" height="461" data-attachment-id="8227" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/select-dacpac-project-for-deployment/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?fit=555%2C461&amp;ssl=1" data-orig-size="555,461" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Select DACPAC project for deployment" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?fit=555%2C461&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?resize=555%2C461&#038;ssl=1" alt="publish dacpac file from Visual Studio" class="wp-image-8227" style="width:406px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?w=555&amp;ssl=1 555w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?resize=300%2C249&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?resize=450%2C374&amp;ssl=1 450w" sizes="(max-width: 555px) 100vw, 555px" /></a></figure>



<h4 class="wp-block-heading">4. Configure the Deployment Target</h4>



<p class="">1. In the <strong>Publish Database</strong> dialog, click <strong>Edit</strong> to specify the target database.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="835" height="374" data-attachment-id="8228" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/edit-target-server-credentials/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?fit=835%2C374&amp;ssl=1" data-orig-size="835,374" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Edit target server credentials" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?fit=835%2C374&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?resize=835%2C374&#038;ssl=1" alt="Create Azure SQL database connection for dacpac deployment " class="wp-image-8228" style="width:558px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?w=835&amp;ssl=1 835w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?resize=300%2C134&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?resize=768%2C344&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?resize=450%2C202&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?resize=600%2C269&amp;ssl=1 600w" sizes="(max-width: 835px) 100vw, 835px" /></a></figure>



<p class="">2. In the <strong>Edit Target Database Connection</strong> window:</p>



<ul class="wp-block-list">
<li class="">Select <strong>Azure SQL Database</strong> as the target.</li>



<li class="">Enter the server name, authentication details, and select the target database.</li>



<li class="">Test the connection to ensure it is valid.</li>



<li class="">Click <strong>OK</strong> to confirm.</li>
</ul>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="879" height="645" data-attachment-id="8229" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/provide-target-server-and-database-details/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?fit=879%2C645&amp;ssl=1" data-orig-size="879,645" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Provide target server and database details" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?fit=879%2C645&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=879%2C645&#038;ssl=1" alt="Deploy DACPAC to Azure SQL Database" class="wp-image-8229" style="width:555px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?w=879&amp;ssl=1 879w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=300%2C220&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=845%2C620&amp;ssl=1 845w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=768%2C564&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=450%2C330&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=600%2C440&amp;ssl=1 600w" sizes="(max-width: 879px) 100vw, 879px" /></a></figure>



<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h4 class="wp-block-heading">5. Review and Publish</h4>



<p class="">1. Back in the <strong>Publish Database</strong> dialog, review the settings to ensure the correct DACPAC file and target database are selected.</p>



<p class="">2. Optionally, click <strong>Advanced</strong> to configure deployment options such as excluding certain schema changes as shown in the below image.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="507" height="639" data-attachment-id="8250" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/image-29/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?fit=507%2C639&amp;ssl=1" data-orig-size="507,639" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?fit=507%2C639&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?resize=507%2C639&#038;ssl=1" alt="" class="wp-image-8250" style="width:378px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?w=507&amp;ssl=1 507w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?resize=238%2C300&amp;ssl=1 238w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?resize=492%2C620&amp;ssl=1 492w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?resize=450%2C567&amp;ssl=1 450w" sizes="(max-width: 507px) 100vw, 507px" /></a></figure>



<p class="">3. Click <strong>Publish</strong> to start the deployment process.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="683" height="344" data-attachment-id="8230" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/click-publish-dapac-project-to-azure-sql/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?fit=683%2C344&amp;ssl=1" data-orig-size="683,344" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}" data-image-title="Click publish dapac project to azure sql" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?fit=683%2C344&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?resize=683%2C344&#038;ssl=1" alt="Deploy DACPAC to Azure SQL Database" class="wp-image-8230" style="width:535px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?w=683&amp;ssl=1 683w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?resize=300%2C151&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?resize=450%2C227&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?resize=600%2C302&amp;ssl=1 600w" sizes="(max-width: 683px) 100vw, 683px" /></a></figure>



<h4 class="wp-block-heading">6. Monitor and Verify Deployment</h4>



<ol start="1" class="wp-block-list">
<li class="">Monitor the progress of dacpac publish in Visual Studio as shown in the below image.</li>



<li class="">Once the deployment is complete, open <strong>SQL Server Management Studio (SSMS)</strong> or use Visual Studio’s built-in tools to verify the schema changes in your Azure SQL Database.</li>



<li class="">Run test queries to confirm the database is functioning as expected.</li>
</ol>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="677" height="90" data-attachment-id="8231" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/monitor-the-progress-of-deployment/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?fit=677%2C90&amp;ssl=1" data-orig-size="677,90" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="monitor the progress of deployment" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?fit=677%2C90&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?resize=677%2C90&#038;ssl=1" alt="" class="wp-image-8231" style="width:581px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?w=677&amp;ssl=1 677w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?resize=300%2C40&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?resize=450%2C60&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?resize=600%2C80&amp;ssl=1 600w" sizes="(max-width: 677px) 100vw, 677px" /></a></figure>



<p class="has-background" style="background-color:#bcefca"><strong>Pro tips:</strong><br>1. Refer to this <a href="https://azureops.org/articles/implement-azure-sql-database-deployment-ci-cd-pipeline/" target="_blank" rel="noreferrer noopener">post </a>if you wish to Automate Azure SQL Database deployment using Azure DevOps CICD pipeline.<br>2. If you skip target platform change step during the deployment, you may get an error &#8220;A project which specifies SQL Server 2022 or Azure SQL Database Managed Instance as the target platform cannot be published to Microsoft Azure SQL Database v12.&#8221;. Refer to this <a href="https://azureops.org/articles/a-project-which-specifies-sql-server-2022-or-azure-sql-database-managed-instance-as-the-target-platform-cannot-be-published-to-microsoft-azure-sql-database-v12/" target="_blank" rel="noreferrer noopener">post </a>to learn more about it.<br>3. Test your DACPAC deployment on a local environment before pushing it to Azure.<br>4. Always take a backup of your target Azure SQL Database before deployment.<br>5. Use tools like SQL Compare to identify schema differences between the DACPAC and the target database.<br></p>



<h2 class="wp-block-heading">FAQ</h2>


<div class="wp-block-uagb-faq uagb-faq__outer-wrap uagb-block-f06236a7 uagb-faq-icon-row uagb-faq-layout-accordion uagb-faq-expand-first-true uagb-faq-inactive-other-true uagb-faq__wrap uagb-buttons-layout-wrap uagb-faq-equal-height     " data-faqtoggle="true" role="tablist"><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-3becbfb9 " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">1. How do I deploy a DACPAC using SSMS?</span></div><div class="uagb-faq-content"><p>In SQL Server Management Studio, right-click the target database → Tasks → Deploy Data-tier Application → select your DACPAC file.</p></div></div><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-e5bcb60d " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">2. Can I deploy a DACPAC using command line?</span></div><div class="uagb-faq-content"><p>Yes. Use the <code>sqlpackage.exe /Action:Publish /SourceFile:mydb.dacpac /TargetConnectionString:"..."</code> command.</p></div></div><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-dfafc55e " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">3. What errors are common during DACPAC deployment?</span></div><div class="uagb-faq-content"><p>Common issues include schema conflicts, missing permissions, and version mismatches. Use <code>/p:BlockOnPossibleDataLoss=false</code> carefully if schema changes drop objects.</p></div></div></div>


<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/">Deploy DACPAC to Azure SQL Database</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8224</post-id>	</item>
		<item>
		<title>Parse JSON in SQL Server</title>
		<link>https://azureops.org/articles/parse-json-in-sql-server/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Thu, 17 Oct 2024 16:29:43 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8180</guid>

					<description><![CDATA[<p>JSON (JavaScript Object Notation) is a lightweight data-interchange format that has become a standard for data exchange in web and database applications. With the rise of JSON&#8217;s popularity, SQL Server introduced built-in support for JSON starting with SQL Server 2016. In this article, we will explore how to parse JSON in SQL Server and extract [&#8230;]</p>
<p>The post <a href="https://azureops.org/articles/parse-json-in-sql-server/">Parse JSON in SQL Server</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">JSON (JavaScript Object Notation) is a lightweight data-interchange format that has become a standard for data exchange in web and database applications. With the rise of JSON&#8217;s popularity, SQL Server introduced built-in support for JSON starting with <a href="https://azureops.org/articles/tag/sql-server-2025-preview/" target="_blank" rel="noreferrer noopener">SQL Server</a> 2016. In this article, we will explore how to parse JSON in SQL Server and extract meaningful data with practical examples.</p>



<h2 class="wp-block-heading">Why JSON in SQL Server?</h2>



<p class="">JSON allows applications to exchange structured data with simplicity and efficiency. SQL Server’s JSON support makes it easy to:</p>



<ol start="1" class="wp-block-list">
<li class="">Store JSON data in table columns.</li>



<li class="">Query JSON data directly from the database.</li>



<li class="">Transform JSON data into relational formats.</li>
</ol>



<p class="">The key functions provided by SQL Server for JSON manipulation include:</p>



<ul class="wp-block-list">
<li class=""><code>OPENJSON()</code>: Parses JSON text and returns objects in tabular format.</li>



<li class=""><code>JSON_VALUE()</code>: Extracts a scalar value from a JSON string.</li>



<li class=""><code>JSON_QUERY()</code>: Retrieves a JSON object or array from a JSON string.</li>
</ul>



<h2 class="wp-block-heading">How to Parse JSON in SQL Query</h2>



<p class="">Let us see various examples of parsing JSON strings in SQL Server.</p>



<h3 class="wp-block-heading">Parsing JSON with OPENJSON()</h3>



<p class="">The <code>OPENJSON()</code> function is the most versatile tool for working with JSON in SQL Server. It can parse JSON text and return a result set that can be queried like a regular table.</p>



<h4 class="wp-block-heading">Example 1: Basic JSON Parsing</h4>



<p class="">Suppose you have the following JSON stored in a variable:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
DECLARE @json NVARCHAR(MAX) =
    N&#039;{
        &quot;employees&quot;: &#x5B;
            {&quot;id&quot;: 1, &quot;name&quot;: &quot;John Doe&quot;, &quot;role&quot;: &quot;Manager&quot;},
            {&quot;id&quot;: 2, &quot;name&quot;: &quot;Jane Smith&quot;, &quot;role&quot;: &quot;Developer&quot;}
        ]
    }&#039;;
</pre></div>


<p class="">To parse this JSON and extract the employee details, you can use <code>OPENJSON()</code> with a specified path:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
SELECT id, name, role
FROM OPENJSON(@json, &#039;$.employees&#039;)
WITH (
    id INT &#039;$.id&#039;,
    name NVARCHAR(50) &#039;$.name&#039;,
    role NVARCHAR(50) &#039;$.role&#039;
);
</pre></div>


<p class=""><strong>Output:</strong></p>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-1.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="216" height="98" data-attachment-id="8185" data-permalink="https://azureops.org/articles/parse-json-in-sql-server/image-23/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-1.png?fit=216%2C98&amp;ssl=1" data-orig-size="216,98" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-1.png?fit=216%2C98&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-1.png?resize=216%2C98&#038;ssl=1" alt="" class="wp-image-8185"/></a></figure>



<p class=""><strong>Explanation:</strong></p>



<ul class="wp-block-list">
<li class=""><code>'$'</code> denotes the root of the JSON object.</li>



<li class=""><code>$.employees</code> navigates to the <code>employees</code> array within the JSON.</li>



<li class="">The <code>WITH</code> clause specifies the schema for the JSON fields to be extracted.</li>
</ul>



<h3 class="wp-block-heading">Extracting Values with JSON_VALUE()</h3>



<p class="">The function is ideal if you need to extract individual values from a JSON string.</p>



<h4 class="wp-block-heading">Example 2: Extract a Specific Value</h4>



<p class="">Using the same JSON example above, you can retrieve the name of the first employee:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
SELECT JSON_VALUE(@json, &#039;$.employees&#x5B;0].name&#039;) AS FirstEmployeeName;
</pre></div>


<p class=""><strong>Output:</strong></p>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-2.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="171" height="71" data-attachment-id="8186" data-permalink="https://azureops.org/articles/parse-json-in-sql-server/image-24/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-2.png?fit=171%2C71&amp;ssl=1" data-orig-size="171,71" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-2.png?fit=171%2C71&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-2.png?resize=171%2C71&#038;ssl=1" alt="" class="wp-image-8186"/></a></figure>



<h3 class="wp-block-heading">Extracting Nested Objects with JSON_QUERY()</h3>



<p class="">The <code>JSON_QUERY()</code> function is used to extract complex objects or arrays from a JSON string.</p>



<h4 class="wp-block-heading">Example 3: Extract an Array</h4>



<p class="">To extract the entire <code>employees</code> array:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
SELECT JSON_QUERY(@json, &#039;$.employees&#039;) AS EmployeesArray;
</pre></div>


<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h3 class="wp-block-heading">Combining JSON Functions in Queries</h3>



<p class="">You can combine these functions to manipulate and query JSON data effectively.</p>



<h4 class="wp-block-heading">Example 4: Parsing JSON Stored in a Table</h4>



<p class="">Assume you have a table named <code>EmployeeData</code> with a column <code>EmployeeJSON</code> that stores JSON strings.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
CREATE TABLE EmployeeData (
    Id INT IDENTITY PRIMARY KEY,
    EmployeeJSON NVARCHAR(MAX)
);

INSERT INTO EmployeeData (EmployeeJSON)
VALUES
(N&#039;{&quot;id&quot;: 1, &quot;name&quot;: &quot;John Doe&quot;, &quot;role&quot;: &quot;Manager&quot;}&#039;),
(N&#039;{&quot;id&quot;: 2, &quot;name&quot;: &quot;Jane Smith&quot;, &quot;role&quot;: &quot;Developer&quot;}&#039;);
</pre></div>


<p class="">To extract and display employee details:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
SELECT
    JSON_VALUE(EmployeeJSON, &#039;$.id&#039;) AS EmployeeId,
    JSON_VALUE(EmployeeJSON, &#039;$.name&#039;) AS EmployeeName,
    JSON_VALUE(EmployeeJSON, &#039;$.role&#039;) AS EmployeeRole
FROM EmployeeData;
</pre></div>


<p class=""><strong>Output:</strong></p>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-3.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="291" height="90" data-attachment-id="8187" data-permalink="https://azureops.org/articles/parse-json-in-sql-server/image-25/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-3.png?fit=291%2C90&amp;ssl=1" data-orig-size="291,90" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-3.png?fit=291%2C90&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-3.png?resize=291%2C90&#038;ssl=1" alt="" class="wp-image-8187"/></a></figure>



<h3 class="wp-block-heading">Parsing Complex JSON Objects</h3>



<p class="">SQL Server can handle deeply nested JSON structures. Let’s consider a more complex example:</p>



<h4 class="wp-block-heading">Example 5: Parsing Nested JSON with Arrays and Objects</h4>



<p class="">Suppose you have a JSON structure with nested objects:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
DECLARE @complexJson NVARCHAR(MAX) =
    N&#039;{
        &quot;company&quot;: {
            &quot;name&quot;: &quot;TechCorp&quot;,
            &quot;employees&quot;: &#x5B;
                {
                    &quot;id&quot;: 1,
                    &quot;name&quot;: &quot;John Doe&quot;,
                    &quot;details&quot;: {
                        &quot;role&quot;: &quot;Manager&quot;,
                        &quot;salary&quot;: 75000
                    }
                },
                {
                    &quot;id&quot;: 2,
                    &quot;name&quot;: &quot;Jane Smith&quot;,
                    &quot;details&quot;: {
                        &quot;role&quot;: &quot;Developer&quot;,
                        &quot;salary&quot;: 60000
                    }
                }
            ]
        }
    }&#039;;
</pre></div>


<p class="">To extract employee details including nested properties:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
SELECT id, name, role, salary
FROM OPENJSON(@complexJson, &#039;$.company.employees&#039;)
WITH (
    id INT &#039;$.id&#039;,
    name NVARCHAR(50) &#039;$.name&#039;,
    role NVARCHAR(50) &#039;$.details.role&#039;,
    salary INT &#039;$.details.salary&#039;
);
</pre></div>


<p class=""><strong>Explanation:</strong></p>



<ul class="wp-block-list">
<li class="">The path <code>$.company.employees</code> navigates to the employees array inside the <code>company</code> object.</li>



<li class="">Nested properties like <code>role</code> and <code>salary</code> are accessed using the full JSON path (<code>$.details.role</code> and <code>$.details.salary</code>).</li>
</ul>



<p class=""><strong>Output:</strong></p>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-4.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="266" height="96" data-attachment-id="8192" data-permalink="https://azureops.org/articles/parse-json-in-sql-server/image-26/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-4.png?fit=266%2C96&amp;ssl=1" data-orig-size="266,96" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-4.png?fit=266%2C96&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-4.png?resize=266%2C96&#038;ssl=1" alt="" class="wp-image-8192"/></a></figure>



<p class="has-background" style="background-color:#bcefda"><strong>Pro tips:</strong><br>1. SQL Server’s JSON functions make it incredibly simple to parse and manipulate JSON data without requiring additional tools or complex workarounds. Whether you’re working with JSON stored in variables or tables, these functions provide powerful options for extracting and querying data.<br>2. Understanding these features simplifies JSON handling and enhances your ability to work effectively with modern data formats. Start leveraging SQL Server’s JSON capabilities in your next project to streamline your data workflows.<br>3. SQL Server 2025 private preview is announced. Read more about it <a href="https://azureops.org/articles/sql-server-2025/" target="_blank" rel="noreferrer noopener">here</a>.<br>4. If you want to improve performance of SQL Server database, you can find long running queries by following this <a href="https://azureops.org/articles/find-long-running-queries-in-azure-sql-database/" target="_blank" rel="noreferrer noopener">post</a>.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/parse-json-in-sql-server/">Parse JSON in SQL Server</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8180</post-id>	</item>
		<item>
		<title>A project which specifies SQL Server 2022 or Azure SQL Database Managed Instance as the target platform cannot be published to Microsoft Azure SQL Database v12.</title>
		<link>https://azureops.org/articles/a-project-which-specifies-sql-server-2022-or-azure-sql-database-managed-instance-as-the-target-platform-cannot-be-published-to-microsoft-azure-sql-database-v12/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Sat, 10 Aug 2024 12:40:10 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[azure sql cicd]]></category>
		<category><![CDATA[dacpac sql server]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=7974</guid>

					<description><![CDATA[<p>While deploying a DACPAC project to Azure SQL Database using Azure DevOps, you may encounter an error due to specifying SQL Server 2022 as the target platform. The article provides steps to fix this issue by changing the target platform to 'Microsoft Azure SQL Database' in Visual Studio and rebuilding the project.</p>
<p>The post <a href="https://azureops.org/articles/a-project-which-specifies-sql-server-2022-or-azure-sql-database-managed-instance-as-the-target-platform-cannot-be-published-to-microsoft-azure-sql-database-v12/">A project which specifies SQL Server 2022 or Azure SQL Database Managed Instance as the target platform cannot be published to Microsoft Azure SQL Database v12.</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">While deploying a DACPAC project to Azure SQL database using Azure DevOps, you may come across &#8216;A project which specifies SQL Server 2022 as the target platform cannot be published to Azure SQL Database v12.&#8217; error. In this article, we will see how to fix this issue.</p>



<h2 class="wp-block-heading">Error</h2>



<p class="">##[error]*** An error occurred during deployment plan generation. Deployment cannot continue.<br>##[error]A project which specifies SQL Server 2022 or Azure SQL Database Managed Instance as the target platform cannot be published to Microsoft Azure SQL Database v12.<br>##[error]The Azure SQL DACPAC task failed. SqlPackage.exe exited with code 1.Check out how to troubleshoot failures at <a href="https://aka.ms/sqlazuredeployreadme#troubleshooting-">https://aka.ms/sqlazuredeployreadme#troubleshooting-</a></p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf.webp?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="531" data-attachment-id="7975" data-permalink="https://azureops.org/articles/a-project-which-specifies-sql-server-2022-or-azure-sql-database-managed-instance-as-the-target-platform-cannot-be-published-to-microsoft-azure-sql-database-v12/a-project-which-specifies-sql-server-2022-or-azure-sql-database-managed-instance-as-the-target-platf/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf.webp?fit=1226%2C543&amp;ssl=1" data-orig-size="1226,543" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf.webp?fit=1200%2C531&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf.webp?resize=1200%2C531&#038;ssl=1" alt="a project which specifies sql server 2022 as the target platform cannot be published to azure." class="wp-image-7975" style="width:1081px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf.webp?resize=1200%2C531&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf.webp?resize=300%2C133&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf.webp?resize=768%2C340&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf.webp?resize=450%2C199&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf.webp?resize=600%2C266&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/A-project-which-specifies-SQL-Server-2022-or-Azure-SQL-Database-Managed-Instance-as-the-target-platf.webp?w=1226&amp;ssl=1 1226w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h2 class="wp-block-heading">Solution</h2>



<p class="">1. Open the database dacpac project in Visual Studio.</p>



<p class="">2. Right Click on the database project and Click on &#8216;Properties&#8217;.</p>



<p class="">3. Open &#8216;Target platform&#8217; drop down and select &#8216;Microsoft Azure SQL Database&#8217;.</p>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Change-target-platfoem-in-dacpac-project.webp?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="830" height="481" data-attachment-id="7977" data-permalink="https://azureops.org/articles/a-project-which-specifies-sql-server-2022-or-azure-sql-database-managed-instance-as-the-target-platform-cannot-be-published-to-microsoft-azure-sql-database-v12/change-target-platfoem-in-dacpac-project/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Change-target-platfoem-in-dacpac-project.webp?fit=830%2C481&amp;ssl=1" data-orig-size="830,481" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Change-target-platfoem-in-dacpac-project" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Change-target-platfoem-in-dacpac-project.webp?fit=830%2C481&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Change-target-platfoem-in-dacpac-project.webp?resize=830%2C481&#038;ssl=1" alt="" class="wp-image-7977" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Change-target-platfoem-in-dacpac-project.webp?w=830&amp;ssl=1 830w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Change-target-platfoem-in-dacpac-project.webp?resize=300%2C174&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Change-target-platfoem-in-dacpac-project.webp?resize=768%2C445&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Change-target-platfoem-in-dacpac-project.webp?resize=450%2C261&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Change-target-platfoem-in-dacpac-project.webp?resize=600%2C348&amp;ssl=1 600w" sizes="(max-width: 830px) 100vw, 830px" /></a></figure>



<p class="">4. Save the project and build it.</p>



<p class="">5. If the build is successful, raise a PR to merge this change with main branch and initiate the Azure DevOps CICD pipeline.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/8YVrxCgdiIg?si=jQ6skABMZiloGfP-" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<p class="has-background" style="background-color:#bcefca"><strong>Pro tips:</strong><br>1. Follow the steps mentioned in the article<a href="https://azureops.org/articles/implement-azure-sql-database-deployment-ci-cd-pipeline/" target="_blank" rel="noreferrer noopener"> deploy azure sql database using devops</a> to automate Azure SQL database deployments.</p>
<p>The post <a href="https://azureops.org/articles/a-project-which-specifies-sql-server-2022-or-azure-sql-database-managed-instance-as-the-target-platform-cannot-be-published-to-microsoft-azure-sql-database-v12/">A project which specifies SQL Server 2022 or Azure SQL Database Managed Instance as the target platform cannot be published to Microsoft Azure SQL Database v12.</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7974</post-id>	</item>
		<item>
		<title>Find Long Running Queries in Azure SQL Database</title>
		<link>https://azureops.org/articles/find-long-running-queries-in-azure-sql-database/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Fri, 19 Jul 2024 07:09:06 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[Azure SQL database performance]]></category>
		<category><![CDATA[long running queries in Azure SQL]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8018</guid>

					<description><![CDATA[<p>This post describes how to find long running queries in Azure SQL Database using dynamic management view query. </p>
<p>The post <a href="https://azureops.org/articles/find-long-running-queries-in-azure-sql-database/">Find Long Running Queries in Azure SQL Database</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">Identifying and optimizing long-running queries is crucial for maintaining the performance and efficiency of your Azure SQL Database. Slow queries can lead to resource bottlenecks, affecting the overall user experience and system stability. In this post.we will see how to find long running queries in Azure SQL database. Whether you&#8217;re a database administrator or a developer, these insights will enable you to ensure your database runs smoothly and efficiently.</p>



<h2 class="wp-block-heading">SQL query to find long running queries in SQL database</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Query to check currently running SQL queries in Azure SQL Database or SQL Server database.

SELECT 
    r.session_id,
    r.status,
    r.command,
    r.start_time,
    r.percent_complete,
    SUBSTRING(qt.text, (r.statement_start_offset/2) + 1, 
    ((CASE r.statement_end_offset 
        WHEN -1 THEN DATALENGTH(qt.text)
        ELSE r.statement_end_offset 
        END - r.statement_start_offset)/2) + 1) AS query_text,
    s.host_name,
    s.login_name,
    s.program_name,
    s.client_interface_name,
    r.database_id,
    DB_NAME(r.database_id) AS database_name,
    r.total_elapsed_time,
    r.cpu_time,
    r.reads,
    r.writes,
    r.logical_reads
FROM 
    sys.dm_exec_requests r
JOIN 
    sys.dm_exec_sessions s ON r.session_id = s.session_id
CROSS APPLY 
    sys.dm_exec_sql_text(r.sql_handle) AS qt
WHERE 
    r.session_id &lt;&gt; @@SPID
ORDER BY 
    r.start_time DESC;

</pre></div>


<p class="">Here,<br>sys.dm_exec_requests (r): Lists currently executing requests.<br>sys.dm_exec_sessions (s): Contains info on active user connections and internal tasks.<br>sys.dm_exec_sql_text (qt): Retrieves the text of the SQL batch for the given SQL handle.</p>



<p class="has-background" style="background-color:#bcefca"><strong>Pro tips:</strong><br>1. <a href="https://learn.microsoft.com/en-us/azure/azure-sql/database/monitoring-with-dmvs?view=azuresql" target="_blank" rel="noreferrer noopener">DMV queries</a> should be run with caution in production environments. <br>2. Above query can also be run the check currently running queries in SQL Server database.<br>3. In case you want to automate database maintenance in Azure SQL, refer to <a href="https://azureops.org/articles/automating-azure-sql-database-maintenance-tasks/" target="_blank" rel="noreferrer noopener">this </a>post. </p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/find-long-running-queries-in-azure-sql-database/">Find Long Running Queries in Azure SQL Database</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8018</post-id>	</item>
		<item>
		<title>Implement Azure SQL Database Deployment CI CD pipeline</title>
		<link>https://azureops.org/articles/implement-azure-sql-database-deployment-ci-cd-pipeline/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Wed, 03 Apr 2024 08:35:20 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[azure devops yaml templates]]></category>
		<category><![CDATA[azure sql deployment]]></category>
		<category><![CDATA[ci cd pipelines]]></category>
		<category><![CDATA[deployment automations]]></category>
		<category><![CDATA[sql server cicd]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=7457</guid>

					<description><![CDATA[<p>In this blog post, we'll delve into the step-by-step guide of how to implement Azure SQL database Deployment CI CD pipeline using Azure DevOps.</p>
<p>The post <a href="https://azureops.org/articles/implement-azure-sql-database-deployment-ci-cd-pipeline/">Implement Azure SQL Database Deployment CI CD pipeline</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">In today&#8217;s rapidly evolving digital landscape, deploying and managing database objects efficiently is crucial for maintaining the agility and scalability of modern applications. <a href="https://learn.microsoft.com/en-us/azure/azure-sql/database/sql-database-paas-overview?view=azuresql" target="_blank" rel="noreferrer noopener">Azure SQL Database</a>, a fully managed relational database service provided by Microsoft, offers a robust platform for storing and managing data in the cloud. Leveraging Azure DevOps Continuous Integration and Continuous Deployment (CI CD) pipelines streamlines the process of deploying SQL database objects, ensuring consistency, reliability, and rapid iteration. In this blog post, we&#8217;ll delve into the step-by-step guide of how to implement Azure SQL Server CICD pipeline using Azure DevOps.</p>



<p class="has-pale-cyan-blue-background-color has-background"><strong>Prerequisites</strong>:<br>1.<a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&amp;tabs=yaml" target="_blank" rel="noreferrer noopener">Service connections</a> in Azure DevOps project for each resource groups containing Azure SQL databases.</p>



<h2 class="wp-block-heading">Create a database project and link it to Azure Repos</h2>



<p class="">When setting up a CI/CD pipeline for Azure SQL Database, it&#8217;s essential to understand how to create a DACPAC file and utilize Visual Studio to a database project from it. This project then needs to be integrated with Azure Repos for setting up an automated build and deployment pipeline. In case you already have this setup, you can skip this section.</p>



<h3 class="wp-block-heading">Create a DACPAC file</h3>



<p class=""> A DACPAC (Data-tier Application Component Package) file is a portable representation of a SQL Server database schema, making it crucial for efficiently managing database changes. Follow the steps mentioned in <a href="https://azureops.org/articles/dacpac-sql-server-database/" target="_blank" rel="noreferrer noopener">this </a>post to learn how to create it. If you already have a database project, you can skip this step.</p>



<h3 class="wp-block-heading">Create a database project from the DACPAC file</h3>



<p class="">Once the DACPAC file is ready, integrating it into a Visual Studio project becomes imperative for further development and deployment. Detailed instructions on opening a DACPAC file in Visual Studio can be found in the <a href="https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/" target="_blank" rel="noreferrer noopener">guide </a></p>



<h3 class="wp-block-heading">Link database project with Azure Repos</h3>



<p class="">Create a repo in Azure DevOps under the DevOps organization project and link the database project with it. Follow the steps mentioned in <a href="https://docs.devart.com/source-control/linking-to-source-control/linking-db-to-git-repository-in-azure-devops.html" target="_blank" rel="noreferrer noopener">this </a>post to learn about it.</p>



<h2 class="wp-block-heading">Setup Azure SQL Server CICD pipeline</h2>



<p class="">Once we have Azure repo ready for Azure SQL database projects, let us now implement SQL DACPAC deployment Azure DevOps pipeline.</p>



<h3 class="wp-block-heading">Enable access to Azure Key Vault from Azure DevOps pipelines</h3>



<p class="">To connect to Azure SQL Database from Azure DevOps deployment pipeline, we need to fetch database credentials from Azure Key Vault. Follow the<a href="https://azureops.org/articles/access-key-vault-from-azure-devops-pipeline/" target="_blank" rel="noreferrer noopener"> </a>steps mentioned in <a href="https://azureops.org/articles/access-key-vault-from-azure-devops-pipeline/">this </a>article to enable access to Azure Key Vault secrets from Azure DevOps pipeline.</p>



<h3 class="wp-block-heading">Create a new pipeline in Azure DevOps project</h3>



<p class="">It&#8217;s time to set up a deployment pipeline for the Azure SQL database.</p>



<p class="">1. Login to Azure DevOps <a href="https://dev.azure.com/" target="_blank" rel="noreferrer noopener">portal </a>and navigate to the DevOps organization. Select the DevOps project containing the database Azure repo we created in the above step.</p>



<p class="">2. Select Pipelines and Click &#8216;New pipeline&#8217; button to create a new pipeline. </p>



<p class="">3. Select &#8216;Azure Repos Git&#8217; as a source of your code. </p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Create-new-devops-pipeline.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="834" height="366" data-attachment-id="7477" data-permalink="https://azureops.org/articles/implement-azure-sql-database-deployment-ci-cd-pipeline/create-new-devops-pipeline/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Create-new-devops-pipeline.png?fit=834%2C366&amp;ssl=1" data-orig-size="834,366" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Create-new-devops-pipeline" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Create-new-devops-pipeline.png?fit=834%2C366&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Create-new-devops-pipeline.png?resize=834%2C366&#038;ssl=1" alt="SQL Server CICD " class="wp-image-7477" style="width:653px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Create-new-devops-pipeline.png?w=834&amp;ssl=1 834w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Create-new-devops-pipeline.png?resize=300%2C132&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Create-new-devops-pipeline.png?resize=768%2C337&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Create-new-devops-pipeline.png?resize=450%2C197&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Create-new-devops-pipeline.png?resize=600%2C263&amp;ssl=1 600w" sizes="(max-width: 834px) 100vw, 834px" /></a></figure>



<p class="">4. Select the Azure repo containing the database project we created in previous steps.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-DevOps-repository.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="808" height="398" data-attachment-id="7476" data-permalink="https://azureops.org/articles/implement-azure-sql-database-deployment-ci-cd-pipeline/select-devops-repository/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-DevOps-repository.png?fit=808%2C398&amp;ssl=1" data-orig-size="808,398" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Select-DevOps-repository" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-DevOps-repository.png?fit=808%2C398&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-DevOps-repository.png?resize=808%2C398&#038;ssl=1" alt="Select Azure SQL database repository in devops pipeline." class="wp-image-7476" style="width:643px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-DevOps-repository.png?w=808&amp;ssl=1 808w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-DevOps-repository.png?resize=300%2C148&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-DevOps-repository.png?resize=768%2C378&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-DevOps-repository.png?resize=450%2C222&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-DevOps-repository.png?resize=600%2C296&amp;ssl=1 600w" sizes="(max-width: 808px) 100vw, 808px" /></a></figure>



<p class="">5. On the Configure screen, select the &#8216;Starter pipeline&#8217; option as shown in the image below.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-Starter-pipeline.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="839" height="639" data-attachment-id="7478" data-permalink="https://azureops.org/articles/implement-azure-sql-database-deployment-ci-cd-pipeline/select-starter-pipeline/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-Starter-pipeline.png?fit=839%2C639&amp;ssl=1" data-orig-size="839,639" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Select-Starter-pipeline" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-Starter-pipeline.png?fit=839%2C639&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-Starter-pipeline.png?resize=839%2C639&#038;ssl=1" alt="SQL Server CICD " class="wp-image-7478" style="aspect-ratio:1;width:441px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-Starter-pipeline.png?w=839&amp;ssl=1 839w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-Starter-pipeline.png?resize=300%2C228&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-Starter-pipeline.png?resize=814%2C620&amp;ssl=1 814w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-Starter-pipeline.png?resize=768%2C585&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-Starter-pipeline.png?resize=450%2C343&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/03/Select-Starter-pipeline.png?resize=600%2C457&amp;ssl=1 600w" sizes="(max-width: 839px) 100vw, 839px" /></a></figure>



<p class="">6. Add below YAML code to the editor on Review screen and make necessary changes as per your environment. You can use YAML pipeline tasks to generate the code snippets based on your parameter values. </p>



<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; highlight: [58,60,62,68,71,75,76]; title: ; notranslate">
trigger:
# Name of the main (master) branch of the Azure DevOps repos. 
- main

variables:
  vmImageName: &#039;windows-latest&#039;
  solution: &#039;**/*.sln&#039;
  buildPlatform: &#039;Any CPU&#039;
  buildConfiguration: &#039;Release&#039;

stages:
- stage: build
  displayName: Build Stage
  jobs:
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)
    steps:
    - task: NuGetToolInstaller@1
    - task: NuGetCommand@2
      inputs:
        restoreSolution: &#039;$(solution)&#039;
    - task: VSBuild@1
      inputs:
        solution: &#039;$(solution)&#039;
        platform: &#039;$(buildPlatform)&#039;
        configuration: &#039;$(buildConfiguration)&#039;
    - task: CopyFiles@2
      inputs:
        SourceFolder: &#039;$(agent.builddirectory)&#039;
        Contents: &#039;**/bin/$(buildConfiguration)/**&#039;
        TargetFolder: &#039;$(build.artifactstagingdirectory)&#039;
        CleanTargetFolder: true
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: &#039;$(build.artifactstagingdirectory)&#039;
        ArtifactName: &#039;drop&#039;
        publishLocation: &#039;Container&#039;

- stage: dev
  displayName: Dev Deploy Stage
  dependsOn: build
  condition: and(succeeded(), ne(variables&#x5B;&#039;Build.Reason&#039;], &#039;PullRequest&#039;))
  jobs: 
  - deployment: Deploy
    displayName: Deploy Dev
    pool:
      vmImage: $(vmImageName)
    environment: dev
    strategy:
      runOnce:
        deploy:
          steps:
          - task: AzureKeyVault@1
            inputs:
             # Enter name of the service connection created to deploy resources to dev Azure SQL database. 
              AzureSubscription: &#039;dev-service-connection-name&#039;
             # Enter name of the key vault that stores Azure SQL database credentials. 
              KeyVaultName: &#039;dev-keyva&#039;
             # Enter comma separated names of the key vault secrets that store the Azure SQL database credentials.
              SecretsFilter: &#039;azuresqldb-dbconnstring&#039;
              RunAsPreJob: true

          - task: SqlAzureDacpacDeployment@1
            inputs:
             # Enter name of the service connection created to deploy resources to dev Azure SQL database. 
              AzureSubscription: &#039;dev-service-connection-name&#039;
              AuthenticationType: &#039;connectionString&#039;
             # Provide the database connection string variable value to ConnectionString parameter. (key vault secret name)
              ConnectionString: &#039;$(azuresqldb-dbconnstring)&#039;
              DeployType: &#039;DacpacTask&#039;
              DeploymentAction: &#039;Publish&#039;
              # Provide path of the dacpac file. Replace &#039;AzureOps.Sql&#039; with name of your AzureRepo and AzureOps.Sql.dacpac with name of your database dacpac file.
              DacpacFile: &#039;$(Pipeline.Workspace)/drop/s/AzureOps.Sql/bin/Release/AzureOps.Sql.dacpac&#039;
              AdditionalArguments: &#039;/p:DropObjectsNotInSource=true /p:BlockOnPossibleDataLoss=true /p:IgnorePermissions=true /p:ExcludeObjectTypes=&quot;Users;Permissions&quot;&#039;
              IpDetectionMethod: &#039;AutoDetect&#039;

# similarly, customise below block of code for test environment deployment.
- stage: test
  displayName: Test Deploy Stage
  dependsOn: dev
  condition: and(succeeded(), ne(variables&#x5B;&#039;Build.Reason&#039;], &#039;PullRequest&#039;))
  jobs: 
  - deployment: Deploy
    displayName: Deploy Test
    pool:
      vmImage: $(vmImageName)
    environment: test
    strategy:
      runOnce:
        deploy:
          steps:
          - task: AzureKeyVault@1
            inputs:
              AzureSubscription: &#039;test-service-connection-name&#039;
              KeyVaultName: &#039;test-keyva&#039;
              SecretsFilter: &#039;azuresqldb-dbconnstring&#039;
              RunAsPreJob: true

          - task: SqlAzureDacpacDeployment@1
            inputs:
              azureSubscription: &#039;test-service-connection-name&#039;
              AuthenticationType: &#039;connectionString&#039;
              ConnectionString: &#039;$(azuresqldb-dbconnstring)&#039;
              DeployType: &#039;DacpacTask&#039;
              DeploymentAction: &#039;Publish&#039;
              DacpacFile: &#039;$(Pipeline.Workspace)/drop/s/AzureOps.Sql/bin/Release/AzureOps.Sql.dacpac&#039;
              AdditionalArguments: &#039;/p:DropObjectsNotInSource=true /p:BlockOnPossibleDataLoss=true /p:IgnorePermissions=true /p:ExcludeObjectTypes=&quot;Users;Permissions&quot;&#039;     
              IpDetectionMethod: &#039;AutoDetect&#039;
</pre></div>


<p class="has-background" style="background-color:#f1e4bf"><strong>Note:</strong><br>You can add AdditionalArguments to SqlAzureDacpacDeployment task like DropObjectsNotInSource=true which will drop objects from the database which do not exists in DACPAC file. <a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.sqlserver.dac.dacdeployoptions.additionaldeploymentcontributorarguments?view=sql-dacfx-162" target="_blank" rel="noreferrer noopener">Read </a>more about all the properties supported in SqlAzureDacpacDeployment. Exercise this with caution.</p>



<h2 class="wp-block-heading">Review and test the pipeline</h2>



<p class="">Click on &#8216;Run pipeline&#8217; button to manually trigger the pipeline and test if the pipeline works without any issues.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/04/Run-Azure-devops-pipeline-manually.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="276" data-attachment-id="7621" data-permalink="https://azureops.org/articles/implement-azure-sql-database-deployment-ci-cd-pipeline/run-azure-devops-pipeline-manually/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/04/Run-Azure-devops-pipeline-manually.png?fit=1228%2C282&amp;ssl=1" data-orig-size="1228,282" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Run-Azure-devops-pipeline-manually" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/04/Run-Azure-devops-pipeline-manually.png?fit=1200%2C276&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/04/Run-Azure-devops-pipeline-manually.png?resize=1200%2C276&#038;ssl=1" alt="" class="wp-image-7621" style="width:880px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/04/Run-Azure-devops-pipeline-manually.png?resize=1200%2C276&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/04/Run-Azure-devops-pipeline-manually.png?resize=300%2C69&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/04/Run-Azure-devops-pipeline-manually.png?resize=768%2C176&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/04/Run-Azure-devops-pipeline-manually.png?resize=450%2C103&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/04/Run-Azure-devops-pipeline-manually.png?resize=600%2C138&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/04/Run-Azure-devops-pipeline-manually.png?w=1228&amp;ssl=1 1228w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h2 class="wp-block-heading">How to Manually Deploy DACPAC project to Azure SQL Database</h2>



<p class="">Refer to this <a href="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/" target="_blank" rel="noreferrer noopener">post </a>if you want to deploy DACPAC project to Azure SQL database using Visual Studio.</p>



<p class="has-background" style="background-color:#bcefca"><strong>Pro tips:</strong> <br>1. When publishing a DACPAC, the pipeline might fail with potential data loss errors. Customize the publish parameters according to your specific requirements in such cases.<br>2. Before implementing a block for production deployment, it&#8217;s advisable to thoroughly test the pipeline in lower environments. This ensures that any issues or bugs are identified and resolved before reaching critical stages of deployment.<br>3. To prevent unintended code deployments to higher environments, incorporate mandatory approvals at each stage of deployment. This ensures that changes are reviewed and approved before progressing to the next environment, maintaining the integrity of the deployment process.<br>4. If you come access error &#8216;A project which specifies SQL Server 2022 or Azure SQL Database Managed Instance as the target platform cannot be published to Microsoft Azure SQL Database v12., follow <a href="https://azureops.org/articles/a-project-which-specifies-sql-server-2022-or-azure-sql-database-managed-instance-as-the-target-platform-cannot-be-published-to-microsoft-azure-sql-database-v12/" target="_blank" rel="noreferrer noopener">this </a>article to resolve the issue.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/8YVrxCgdiIg?si=jQ6skABMZiloGfP-" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
<p>The post <a href="https://azureops.org/articles/implement-azure-sql-database-deployment-ci-cd-pipeline/">Implement Azure SQL Database Deployment CI CD pipeline</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7457</post-id>	</item>
		<item>
		<title>Transaction Batching in SQL Server</title>
		<link>https://azureops.org/articles/transaction-batching-in-sql-server/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Thu, 18 Jan 2024 13:19:16 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[transaction batching]]></category>
		<category><![CDATA[transactions in sql server]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=7081</guid>

					<description><![CDATA[<p>This post explores the concept of transaction batching in SQL Server as a solution to efficiently manage resources and avoid unnecessary rollbacks.</p>
<p>The post <a href="https://azureops.org/articles/transaction-batching-in-sql-server/">Transaction Batching in SQL Server</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">SQL Server&#8217;s pessimistic approach to writing transaction log details during DML transactions can lead to challenges, especially in data warehouse workloads. Large-scale updates or deletions may require significant transaction log space, risking transaction failures and prolonged rollbacks. This post explores the concept of transaction batching in SQL Server as a solution to efficiently manage resources and avoid unnecessary rollbacks.</p>



<h2 class="wp-block-heading">Problem</h2>



<p class="">Performing extensive DML operations, particularly in data warehouse scenarios, may lead to transaction log space constraints, risking transaction failures and database downtime during rollbacks.</p>



<h2 class="wp-block-heading">Solution</h2>



<p class="">Transaction batching in SQL Server: Transaction batching, dividing larger transactions into smaller, equal-sized batches, helps optimize resources and minimize the impact of potential rollbacks.</p>



<h2 class="wp-block-heading">Example</h2>



<p class="">Consider a scenario where we batch updates and deletes in a temporary table named #temp. We use the <code>SET ROWCOUNT</code> to limit batch sizes and the <code>@@ROWCOUNT</code> function to track the number of records affected in each batch.</p>



<h4 class="wp-block-heading">Batching Updates</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
CREATE TABLE #temp (
  id INT IDENTITY(1,1),
  name VARCHAR(10),
  flag INT
)

INSERT INTO #temp (name) VALUES 
  (&#039;abc&#039;), (&#039;abc&#039;), (&#039;abc&#039;),
  (&#039;xyz&#039;), (&#039;xyz&#039;), (&#039;xyz&#039;)

DECLARE @updatecount INT = 1

WHILE @updatecount &lt;&gt; 0
BEGIN
  BEGIN TRAN
    SET ROWCOUNT 2
    UPDATE #temp
    SET flag = 1
    WHERE name = &#039;abc&#039; AND flag IS NULL
    SET @updatecount = @@ROWCOUNT
    SET ROWCOUNT 0
  COMMIT TRAN
  CHECKPOINT -- Frees the transaction log space.
END
</pre></div>


<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="944" height="247" data-attachment-id="7084" data-permalink="https://azureops.org/articles/transaction-batching-in-sql-server/image-20/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image.png?fit=944%2C247&amp;ssl=1" data-orig-size="944,247" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image.png?fit=944%2C247&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image.png?resize=944%2C247&#038;ssl=1" alt="Transaction batching in SQL Server for update." class="wp-image-7084" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image.png?w=944&amp;ssl=1 944w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image.png?resize=300%2C78&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image.png?resize=768%2C201&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image.png?resize=450%2C118&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image.png?resize=600%2C157&amp;ssl=1 600w" sizes="(max-width: 944px) 100vw, 944px" /></a></figure>



<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h4 class="wp-block-heading">Batching Deletes</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
DECLARE @deletecount INT = 1

WHILE @deletecount &lt;&gt; 0
BEGIN
  BEGIN TRAN
    SET ROWCOUNT 2
    DELETE FROM #temp WHERE flag = 1
    SET @deletecount = @@ROWCOUNT
    SET ROWCOUNT 0
  COMMIT TRAN
  CHECKPOINT -- Frees the transaction log space.
END
</pre></div>


<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image-1.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="970" height="194" data-attachment-id="7085" data-permalink="https://azureops.org/articles/transaction-batching-in-sql-server/image-1-11/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image-1.png?fit=970%2C194&amp;ssl=1" data-orig-size="970,194" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-1" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image-1.png?fit=970%2C194&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image-1.png?resize=970%2C194&#038;ssl=1" alt="Transaction batching in SQL Server for delete" class="wp-image-7085" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image-1.png?w=970&amp;ssl=1 970w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image-1.png?resize=300%2C60&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image-1.png?resize=768%2C154&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image-1.png?resize=450%2C90&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/01/image-1.png?resize=600%2C120&amp;ssl=1 600w" sizes="(max-width: 970px) 100vw, 970px" /></a></figure>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="">By implementing transaction batching, we can efficiently manage transaction log space and mitigate the risks associated with large-scale DML operations. This approach optimizes resource utilization and reduces the likelihood of extensive rollbacks, ensuring smoother database operations.</p>



<p class="has-background" style="background-color:#bcefca"><strong>Pro tips</strong>:<br>1. <a href="https://azureops.org/articles/find-deadlock-in-sql-server/#:~:text=The%20only%20way%20to%20resolve,off%20one%20of%20the%20processes." target="_blank" rel="noreferrer noopener">Learn </a>how to find and manage deadlocks in SQL Server.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/transaction-batching-in-sql-server/">Transaction Batching in SQL Server</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7081</post-id>	</item>
		<item>
		<title>Open DACPAC File in Visual Studio</title>
		<link>https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Sat, 23 Sep 2023 18:39:04 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[dacpac]]></category>
		<category><![CDATA[dacpac sql server]]></category>
		<category><![CDATA[SQL Server data tools]]></category>
		<category><![CDATA[visual studio]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=6678</guid>

					<description><![CDATA[<p>DACPAC file can be used to deploy database code using CICD tools like Azure DevOps. Learn how to open DACPAC file in Visual Studio.</p>
<p>The post <a href="https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/">Open DACPAC File in Visual Studio</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">DACPAC refers to a Data-Tier Application Package, which is essentially a compressed file that includes a data model or database objects. It is compatible with SQL Server Data Tools (SSDT) database projects and is used for versioning and deploying SQL Server or Azure SQL databases with the help of Azure DevOps CI/CD pipelines. DACPAC files are crucial when migrating your on-premise SQL Server database to Azure SQL database. Additionally, they can be utilized to create projects in Visual Studio and deploy database code using CI/CD tools such as Azure DevOps. This article will show how to open DACPAC file in Visual Studio.</p>



<h2 class="wp-block-heading">How to create a DACPAC file.</h2>



<p class="">To create a DACPAC file from an existing SQL Server or Azure SQL database, you must ensure certain things. Refer to this <a href="https://azureops.org/articles/dacpac-sql-server-database/" target="_blank" rel="noreferrer noopener">post</a> to learn how to create a DACPAC file.</p>



<p class="">Follow the below steps to open DACPAC file in Visual Studio.</p>



<p class="has-pale-cyan-blue-background-color has-background"><strong>Pre-requisites</strong>:<br>1. Visual Studio with <a href="https://learn.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-ver16" target="_blank" rel="noreferrer noopener">SSDT</a> extension installed. </p>



<h3 class="wp-block-heading">1. Create a new blank project in Visual Studio</h3>



<p class="">1. Open Visual Studio, click on the File menu item, and Select &#8216;New&#8217; &#8211; &gt; &#8216;Project&#8217; as shown in the below image.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="704" data-attachment-id="6685" data-permalink="https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/image-4-4/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?fit=1449%2C850&amp;ssl=1" data-orig-size="1449,850" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-4" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?fit=1200%2C704&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?resize=1200%2C704&#038;ssl=1" alt="how to open DACPAC file in Visual Studio" class="wp-image-6685" style="width:1006px;height:590px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?resize=1200%2C704&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?resize=300%2C176&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?resize=1057%2C620&amp;ssl=1 1057w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?resize=768%2C451&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?resize=450%2C264&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?resize=600%2C352&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-4.png?w=1449&amp;ssl=1 1449w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<p class="">2. Select the project type as &#8216;SQL Server Database Project&#8217;. Provide the name to the project and Click OK.</p>



<p class="">This should create a blank database project in Visual Studio.</p>



<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h3 class="wp-block-heading">2. Import DACPAC file into the database project</h3>



<p class="">1. Right-click on the project we just created in the previous step. Click &#8216;Import&#8217; &#8211; &gt; &#8216;Data tier Application (*.dacpac)&#8217; option.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-5.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="928" height="366" data-attachment-id="6686" data-permalink="https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/image-5-3/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-5.png?fit=928%2C366&amp;ssl=1" data-orig-size="928,366" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-5" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-5.png?fit=928%2C366&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-5.png?resize=928%2C366&#038;ssl=1" alt="" class="wp-image-6686" style="width:757px;height:299px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-5.png?w=928&amp;ssl=1 928w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-5.png?resize=300%2C118&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-5.png?resize=768%2C303&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-5.png?resize=450%2C177&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-5.png?resize=600%2C237&amp;ssl=1 600w" sizes="(max-width: 928px) 100vw, 928px" /></a></figure>



<p class="">2. Browse the .dacpac file you want to unpack in the Visual Studio project. Click Start to begin the import process.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="573" data-attachment-id="6687" data-permalink="https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/image-6-2/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?fit=1591%2C760&amp;ssl=1" data-orig-size="1591,760" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-6" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?fit=1200%2C573&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?resize=1200%2C573&#038;ssl=1" alt="how to open DACPAC file in Visual Studio" class="wp-image-6687" style="object-fit:cover;width:1006px;height:484px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?resize=1200%2C573&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?resize=300%2C143&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?resize=768%2C367&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?resize=1536%2C734&amp;ssl=1 1536w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?resize=450%2C215&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?resize=600%2C287&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-6.png?w=1591&amp;ssl=1 1591w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<p class="">3. if there are no errors, you will see the progress shown in the image below.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="562" data-attachment-id="6688" data-permalink="https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/image-7-2/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?fit=1623%2C760&amp;ssl=1" data-orig-size="1623,760" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-7" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?fit=1200%2C562&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?resize=1200%2C562&#038;ssl=1" alt="" class="wp-image-6688" style="object-fit:cover;width:1006px;height:468px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?resize=1200%2C562&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?resize=300%2C140&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?resize=768%2C360&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?resize=1536%2C719&amp;ssl=1 1536w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?resize=450%2C211&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?resize=600%2C281&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-7.png?w=1623&amp;ssl=1 1623w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<p class="">4. You should see all database objects from the DACPAC under the project.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-8.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="547" height="418" data-attachment-id="6690" data-permalink="https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/image-8-2/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-8.png?fit=547%2C418&amp;ssl=1" data-orig-size="547,418" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-8" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-8.png?fit=547%2C418&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-8.png?resize=547%2C418&#038;ssl=1" alt="" class="wp-image-6690" style="width:363px;height:277px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-8.png?w=547&amp;ssl=1 547w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-8.png?resize=300%2C229&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/09/image-8.png?resize=450%2C344&amp;ssl=1 450w" sizes="(max-width: 547px) 100vw, 547px" /></a></figure>



<p class="has-background" style="background-color:#bcefca"><strong>Pro tips:</strong><br>1. It is advisable to always review the content of a DACPAC file before publishing it to a SQL Server or Azure SQL database.<br>2. If Visual Studio is not installed on your system and you wish to access the contents of a DACPAC file, you can do so by renaming the file with a .zip extension. This will enable you to extract the contents of the file and directly view the database objects in File Explorer.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/">Open DACPAC File in Visual Studio</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">6678</post-id>	</item>
	</channel>
</rss>
