Synapse system dacpac missing extended procedures
See original GitHub issue- MSSQL Extension Version: 1.16.0
- VSCode Version: 1.74.2
- OS Version: Windows 10 Enterprise
How to reference system stored procedure like sp_executesql
?
I’m getting this warning for my stored procedure which uses sp_executesql
:
Build warning SQL71502: SqlProcedure: [meta].[usp_test] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [dbo].[sp_executesql] or [meta].[sp_executesql].
I added a reference to the master database but that doesn’t solve the warning, the project file looks like:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build">
<Sdk Name="Microsoft.Build.Sql" Version="0.1.3-preview" />
<PropertyGroup>
<Name>synapse</Name>
<ProjectGuid>{8688EAA4-F8D6-4AB6-9122-F4EC5F406D3B}</ProjectGuid>
<DSP>Microsoft.Data.Tools.Schema.Sql.SqlDwDatabaseSchemaProvider</DSP>
<ModelCollation>1033, CS</ModelCollation>
<DefaultCollation>SQL_Latin1_General_CP1_CS_AS</DefaultCollation>
</PropertyGroup>
<Target Name="BeforeBuild">
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
</Target>
<ItemGroup>
<ArtifactReference Include="./_build/AzureDw_master.dacpac">
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
</ArtifactReference>
</ItemGroup>
</Project>
I tried to reference sys.sp_executesql
(which actually “works” in synapse dedicated pool), but which the compiler still doesn’t like:
stdout: Build warning SQL71502: SqlProcedure: [meta].[usp_test] has an unresolved reference to object [sys].[sp_executesql].
I found this reference from visual studio 2019 where apparently a bug was solved back in 2020, but it doesn’t seem to work for me in vscode mssql extension: https://developercommunity.visualstudio.com/t/Warning-in-VS2019-:-object-does-not-exis/824096.
That same page hints that including a “master” dacpac doesn’t actually work for synapse all together.
Issue Analytics
- State:
- Created 8 months ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Database Project Settings - SQL Server Data Tools (SSDT)
Extended Transact-SQL Verification is a feature within the database project system that allows developers to submit their database project ...
Read more >Some stored procedures are missing in the DACPAC ...
In Sitecore XP 9.0, several of the new stored procedures are not present in the DACPAC for Azure for the Marketing Automation database....
Read more >Missing System Stored Procedures
To re-add them, use the system stored procedure sp_addextendedproc. You'll need to know the DLL where the extended stored procedure can be found ......
Read more >Different Ways to Find SQL Server Object Dependencies
There are a lot of resources available about system objects that will display object dependencies. There are also great examples of how you...
Read more >How to fix the error "String or binary data would be truncated"
First, let's see the error happen: let's create a table with small fields, and then try to insert more data than it holds....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jbtcode I took a look at the master.dacpac for Synapse and noticed it’s missing some elements. It’s actually missing all of the extended procedures including
sp_executesql
. We’ll work on getting those added correctly.Microsoft.Build.Sql 0.1.9-preview has been released. It supports PackageReferences to the Microsoft.SqlServer.Dacpacs Nuget packages (there are also Azure or Synapse variants depending on your target platform). You can reference it via
The other attributes such as
SuppressMissingDependenciesErrors
andDatabaseVariableLiteralValue
can be transferred to the PackageReference as well.You can find more documentation here: https://learn.microsoft.com/en-us/sql/azure-data-studio/extensions/sql-database-project-extension-sdk-style-projects?view=sql-server-ver16#package-references