microsoft / microsoft/DacFx

Extract option - replace DBName in 3-part naming with $(DatabaseName) variable

Open
#611 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

- SqlPackage or DacFx Version: 162.5.57.1
- .NET Framework (Windows-only) or .NET Core:
- Environment (local platform and source/target platforms):
.NET SDK:
Version: 9.0.203
Commit: dc7acfa194
Workload version: 9.0.200-manifests.9df47798
MSBuild version: 17.13.20+a4ef1e90f

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.203\

**Steps to Reproduce:**

1. create a trigger in an Azure SQL database, using a three-part name on the table that self-references the name of the database. So it would be (within the AdventureWorks database) "create trigger dbo.my_trigger_here on "AdventureWorks"."dbo"."mytablehere"..." (we can also duplicate it with "create trigger dbo.my_trigger_here on [Adventureworks].[dbo].[mytablehere]..." The trigger is valid and works. It's not using an external reference so it's legitimate.
2. use SQLPACKAGE to EXTRACT it with VerifyExtraction=true (it didn't extract because of errors, I had to use VerifyExtraction=false, but this may simplify repro)
3. sqlpackage /Action:Extract /SourceServerName:myazsqldb.database.windows.net /SourceDatabaseName:mydbname /SourceUser:myusername /SourcePassword:"mypassword" /TargetFile:myservername-mydbname /p:ExtractTarget=ObjectType /p:ignoreuserloginmappings=false /DiagnosticsFile:20250416_1319.log /p:ExtractAllTableData=false /p:VerifyExtraction=false

**Did this occur in prior versions? If not - which version(s) did it work in?**
No idea - I'm just now trying to set up CI/CD.

(DacFx/SqlPackage/SSMS/Azure Data Studio)
Unsure which, I think DacFx because I'm having the same problem trying to BUILD it in ADS, BUILD it in VS Code (SDK-style database projects), Visual Studio Preview (BUILD from an "SDK-style database project (preview)" with the code) and EXTRACTing with SQLPackage.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the SqlPackage/DacFx Extract path for trigger definitions using three-part table names, and reproduce the case with VerifyExtraction enabled and disabled. Compare the generated result for a self-referencing database name such as AdventureWorks; done means the DBName portion is replaced with the $(DatabaseName) variable and extraction/build succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, sql
Domain
databases, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.