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

SSDT in VS 2022 not finding reference errors. #501

Open
caryhsu700316 opened this issue Oct 1, 2024 · 0 comments
Open

SSDT in VS 2022 not finding reference errors. #501

caryhsu700316 opened this issue Oct 1, 2024 · 0 comments

Comments

@caryhsu700316
Copy link

Problem Description:
I created a database project in visual studio 2022, when moving the temp table join below the reference errors, the build suddenly fails.

Questions:
Why failed to compile the project, after moving the temp table join below the reference errors.
Please help to check for complier issue in VS and SSDT.

I have attached database project and reproduce records in here.
Bi-DB project and records.zip

Error Message:
Severity Code Description Project File Line Suppression State

Error SQL71501: Procedure: [dbo]. [usp_Merge_Salesforce_PipelineRevenue] 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: [$(Fix_OLAP)]. [dbo]. [vw_GeotaxonomyByAreaRegion]. [Geo], [$(Fix_OLAP)]. [dbo]. [vw_GeotaxonomyByAreaRegion]. [newRegion]::[Geo] or [dbo]. [Salesforce_Opportunity]. [newRegion]::[Geo]. Fix_tmp C:\Users\caryhsu\CaseBuddy.CaseData\2407230030008031_Dan\2024-07-23\Bi-DB\Bi-DB\Fix_tmp\dbo\Stored Procedures\usp_Merge_Salesforce_PipelineRevenue.sql 18

Steps to reproduce the problem or scenario:

Download the database project in SSDT(I have open this project in SSDT 2022),you can succssfully to complier the project.
You can try to change the code shows as below, then complier it again, you will get following error message.
Change code from Fix_tmp -> Stored Procedures -> usp_Merge_Salesfore_PipelineRevenue.sql

before:

SELECT
*
FROM Salesforce_Opportunity AS opp
LEFT JOIN #Reset AS cte
ON cte. OpportunityId = opp. Id
LEFT JOIN [$(Fix_OLAP)]… vw_GeotaxonomyByAreaRegion AS newRegion
ON (
opp. Owner_Geo__c = newRegion.Geo
AND opp. Owner_Area__c = newRegion.Area
AND opp. Owner_Region__c = newRegion.Region
) OR (
opp. Owner_Geo__c = ‘Moosend’
AND newRegion.Region = ‘Moosend’
) OR (
opp. Owner_Geo__c = ‘Reflektion’
AND newRegion.Region = ‘Reflektion’
)

After:

SELECT
*
FROM Salesforce_Opportunity AS opp
LEFT JOIN [$(Fix_OLAP)]… vw_GeotaxonomyByAreaRegion AS newRegion
ON (
opp. Owner_Geo__c = newRegion.Geo
AND opp. Owner_Area__c = newRegion.Area
AND opp. Owner_Region__c = newRegion.Region
) OR (
opp. Owner_Geo__c = ‘Moosend’
AND newRegion.Region = ‘Moosend’
) OR (
opp. Owner_Geo__c = ‘Reflektion’
AND newRegion.Region = ‘Reflektion’
)
LEFT JOIN #Reset AS cte
ON cte. OpportunityId = opp. Id

Troubleshooting:

  1. I can easy and always reproduce this issue from the project.

  2. Target framework is “.net framework 4.7.1”, I have try to change the framework to .net 4.8.1, but got the same issue.

  3. I can see a SQLCMD variables defined in Fix_tmp project shows as below, the variable defines and uses in SQLCMD mode, when I try to remove and change code show as below, I can pass the complier when move the temp table after or before the join.

image

  1. We tried can enable the code analysis on build to show more information when build the solution, but it seems to me that this issue related to VS complier.
    image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant