Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error SQL71501 for synonym referencing a table in another database in same solution #520

Open
mrlmachado opened this issue Nov 8, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@mrlmachado
Copy link

mrlmachado commented Nov 8, 2024

  • SqlPackage or DacFx Version: 162.3.566.1
  • .NET Framework (Windows-only) or .NET Core: .NET Core
  • Environment (local platform and source/target platforms):

Steps to Reproduce:

  1. Create a synonym for a table in another database (same solution, different .sqlprojx file referenced in .sqlprojx)
    e.g.
CREATE SYNONYM dbo.Table$Archive     FOR [$(DB_Archive)].dbo.Table;
  1. Use the Synonym inside a view

It will throw the below error when trying to build the solution with dotnet build:

Build error SQL71501: View: [dbo].[TableLog] has an unresolved reference to object [dbo].[Table$Archive].

Did this occur in prior versions? If not - which version(s) did it work in? I'm trying to convert my old .sqlproj file to new sdk-style to apply custom code analysis and it's failing to build because of the above error SQL71501

(DacFx/SqlPackage/SSMS/Azure Data Studio)

@mrlmachado mrlmachado added the bug Something isn't working label Nov 8, 2024
@ErikEJ
Copy link
Contributor

ErikEJ commented Nov 8, 2024

Maybe it is better to attempt this with Azure Data Studio for the time being.

@mrlmachado
Copy link
Author

Hi @ErikEJ ! Thank you for your blazing fast response to my thread.
We are actually trying to upgrade from SSDT VS ancient style to the new-sdk style.
We can still wait, of course, for this bug to be fixed until we can fully upgrade.

@mrlmachado
Copy link
Author

@ErikEJ , just an update:

  • SSDT legacy version works fine.
  • MSBuild.Sdk.SqlProj 3.0.0-beta.2 has the same behavior, synonyms in views, that references another database, throws 71501
  • For Microsoft.Build.Sql version 0.2.3-preview:
  • .sqlprojx using either dotnet build and msbuild has similar results, throwing 71501
  • .sqlproj using dotnet build throws 71501
  • .sqlproj using msbuild works and I can see the .DACPAC is generated correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants