External References to SQL tables in Visual Studio - visual-studio

I'm trying to create a solution that includes a database project linked to an Azure database. The project requires setting up an elastic query to a separate table in a different Azure Database. This all exists already in Azure. I have imported the database using the visual studio wizard. It's imported the external table definition and the external data source, but not the masterkey or the scoped credential. I fully understand why as it's a security risk. However, I now can't publish my changes to the stored procedures etc as the external data sources have syntax errors where the scoped credentials are not defined. I've tried adding the masterkey and scoped credentials to my database project but the same syntax I used in the SQL management studio is not working in Visual Studio.
So my question is... how am I supposed to manage the external tables in my azure database in visual studio? I should mention that I am using VS2015. Is this functionality that is not working yet or am I missing something?
Thanks in advance for any help you guys can give.

Although SSDT gives a syntax error, can you verify that you can still build the project? The syntax error seems to be a intelliSense parser problem which shouldn't block build or deployment. Please let me know if it works.
Disclaimer: I work on the SSDT/DacFx team.

Related

Unable to publish DB project on Azure SQL Data Warehouse

With Visual Studio 2019 (already updated to the latest version), I have created a new SQL Server Database Project connected to an Azure SQL Datawarehouse Database.
I imported all the object already present on the database (tables, stored procedure and schema), I carried out the schema compare which does not detect any difference.
On the project properties I changed the Target platform setting it up on Miscrosoft Azure SQL Data Warehouse, I switched the Compatibility level setting it on SQL Server 2017 (140)
The build of solution is successful, but when I tried to publish the solution I have the following message error
Creating publish preview...
Errors occurred while modeling the target database. Deployment can not continue.
I can generate the publish script only if I check the box Always re-create database, but I don't want drop and re-create the database every time
I did a lot of research but none of them solved my problem.
Anyone knows if there are any known limitations concerning the publish of SQL Server Database Project on Azure SQL Datawarehouse Database or does anyone know how to solve the problem?
Thank you
Deploying database projects to Azure SQL Data Warehouse is in public preview since August if you use Visual Studio 2019 SQL Server Data Tools (SSDT) as documented here. At the bottom of the page Microsoft gives you instructions on how you can provide feedback directly to the SSDT team.
Database projects were not supported on Azure SQL Data Warehouse as you can read here and here.
Check your database tables in the "System Tables." If you have dbo.sysdiagrams,
that won't allow you to deploy the db.
So, if you delete dbo.sysdiagrams table on your database, that will hopefully allow you to deploy the database.
They get created when you click on the database diagrams.

How to save a SQL Server Maintenance Plan within a Visual Studio Database Project

Having created a SQL Server maintenance plan in a SQL Server 2008 R2 instance, how can I import the definitions into a Visual Studio 2013 SSDT database project?
I don't mind using pre- and post-deployment scripts if that helps but I want it to be in a database project and to be able to build the project in VS and then to be able to deploy either a new instance of the plan, or to be able to synchronize an existing plan instance with the definitions in the database project. Also, drop and re-create is entirely acceptable.
Does anyone else already know how to do that ?
First of all maintenance plans are not supported by SSDT.
You can export it manually as an xml template file and then try to write some sql/batch post deploy scripts to deploy it.
You can find general instruction here (read comments also): https://robertbigec.wordpress.com/2013/10/03/automating-deployment-of-sql-server-maintenance-plans/
One note: The exported xml template contains some specific values such as server name or path to backup/log file locations. You might want to write custom script to get these values from target machine and replace it in the xml file.

Visual Studio Project that execute an SQL script

I have this question... probably is similar to Executing scripts from a database project in visual studio
but i didn't understand the solution given.
So i made a Database Server 2008 project inside visual studio.
Just one table. When i press DEPLOY the database is created inside SQLServer2008 and the table is created.
Now what if i would like to give the project to someone who has SQLServer and he needs to recreate the database and the table in his computer?..
Apart form executing the query from Visual Studio is there any way to create an executable that automatically "deploy" from outside Visual Studio?..
Thanks,
There are different types of Database projects in Visual Studio. The old ones, which were not so feature rich. The 'Data Dude' ones that came with Visual Studio 2010 Team Database Edition and the most recent iteration that comes with the SQL Server Data Tools. All of these can be installed on top of the standard Visual Studio Professional and don't require additional licenses.
SQL Server Data Tools is the latest, and also the best integrated and most powerful variant of the bunch. It can also be used to compare existing schema's and generate upgrade scripts or automatically upgrade the schema in an existing database for you.
During build, a package will be created that holds all the schema information for your database. You can then use the command line tools provided by the SQL Server data tools or MSDeploy to deploy your compressed schema file to a new or an existing database.
This deployment mechanism can also upgrade existing schema if needed.

Schema Comparison causes Visual Studio 2010 to crash

When I click on Write Updates and then I confirm, VS stops working. What could be the issue here?
I'm trying to update the database project schema directly from the source database using a schema comparison, as it seems it is the absolute best way to sync those, but I seem unable to execute it on the target project. I haven't tried targeting a database.
http://i.stack.imgur.com/lSUpQ.png

Accessing Visual Studio Database Project Schema Programatically

I'm trying to find a way to access the schema of a database project programatically from within Visual Studio 2010.
For example, if I have a solution containing a SQL Server Database Project which defines tables, views etc, and Visual Studio displays those objects within the schema view, I'd like to be able to enumerate the objects in the schema view.
Can anyone provide some tips or a link? Thanks.
Here is a starting point on MSDN. The "Create Custom Features for Database Projects" part is probably relevant for you.

Resources