'Getting the SQL71561 error while migrating the DB from MS SQL to MS Azure

I have a scenario where I'm calling two different DB in a single view like below.

[DB_Name].[Schema].[Table_Name]

The view is working fine.

Currently I want to migrate the Database to Azure where I have this view. Azure is not allowing me to specify the database name in view. Is there any workaround available to fix this issue. Please advise.

Thanks.

I have tried to remove the db name in view but it resulted in a error.



Solution 1:[1]

To resolve the?SQL71561 build error?please follow:

Add a reference to the other database, clear out the?"Database variable"?field in the dialog. If you don't clear this field, when doing a schema compare, SSDT would generate the script using the database variable name, which would fail.

  1. Add a Database Reference to the project.
  2. If in case the other database was another project in the same solution, you would be able to select it in the first drop down on the "Add Database Reference" dialog.
  3. Make sure the text in the "Database name" field is correct.
  4. Clear out the "Database variable" field.

Look at the "Example usage" text and verify that it looks as expected. Click "OK" to add the reference and that should take care of the 'unresolved reference' errors.

After doing this, you will be able to do a schema comparison, but could get the following error:

Error 408 SQL00208: Invalid object name 'db.schema.table'.

**Go to the project properties and uncheck "Enable extended Transact-SQL verification for common objects" will allow the project to build successfully. **

Consider and follow the below steps when converting existing DB to SSDT:

  1. Create a new SSDT database project

  2. Import the existing DB into that project, which will recreate all the script files and change the way they are organized/grouped

  3. Do some cleanup on a few of the script files, including the post-deploy script

  4. If it is SQLCLR project, make sure master DB stuff has done right (creating logins)

    4.1 Make sure SQLCLR is enabled and configured correctly in the SSDT project's SQLCLR property page

    4.2 Copy the source code for the SQL CLR into the top level of the project

    4.3 Add the references need by the SQL CLR code

  5. Compile

  6. Publish

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PratikLad-MT