SQL Server Database Tools on a Mac - sql-server

I have a DB project which relies on SQL Server Database tools. I am trying to work on it on a Mac. The rest of the project is in .NET Core so that all works well. The database project throws an error on dotnet restore
/Users/mborozdin/src/ethos/FileRepository/src/FileRepository.Database/FileRepository.Database.sqlproj(63,3): error MSB4019: The imported project "/usr/local/share/dotnet/sdk/2.1.4/Microsoft/VisualStudio/v10.0/SSDT/Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
Is there an alternative to SSDT which seems to be only available on Windows?

When you develop on the Mac,
You will put your SQL Server on the docker or Virtual Machine.
In other to connect, You need SQL Operations Studio for the Mac
Download Link

Is there an alternative to SSDT which seems to be only available on Windows?
The alternative is Azure Data Studio. As for:
SQL Database Projects extension
The SQL Database Projects extension brings project-based database development, well-known in SQL Server Data Tools (SSDT), to the cross-platform Azure Data Studio experience. From this early insiders release you can create, build, and publish a project from scratch or an existing database.
https://github.com/microsoft/azuredatastudio/issues/11105

Related

How to create DacPac from script files to automate DB deployment?

I need to automate SQL Server DB deployment using Azure DevOps. I don't want to give any alter statement. I will have a folder structure with tables, stored procedures, views & functions in repository. Every folder will contain only create scripts. Is there anyway to create DacPac file with that folder structure or any other way, other than DacPac deployment using that folder structure?
Note: I don't want to create DB project using Visual Studio. And I don't want to create a DacPac file directly from SQL Server Management Studio and checkin the same to source control. And I am not in a situation to pay for license.
You can try to use SQL Database Projects extension in Azure Data Sudio. It supports VS SQL Database Project and it supports builds from the command line: Build a database project from command line
What you describe is the database project. A dacpac is the build output of a Database project. There are no licenses involved. All the tools that produce dacpac files are free:
Both SQL Server Data Tools (SSDT) and SQL Server Management Studio (SSMS) are free, standalone downloads.
You can install SSDT on top of Visual Studio Community which is also free.
Azure Data Studio supports database projects. Also free, open source and works on Mac and Linux. I'm using it on Mac to edit database projects, using a SQL Server Developer Edition in a Docker container.
The sqlpackage command-line tool can extract a dacpac from an existing database, publish it or generate a migration script. Also free and a standalone download

Not able to build Visual Studio Database Project targeting Azure SQL Database when using AT TIME ZONE

We have a Visual Studio Database Project that we are trying to move to Azure SQL Database. Some of our views use AT TIME ZONE which is supported in Azure SQL Database, but when I switch the database Target Platform to Microsoft Azure SQL Database in the project properties, it fails to build with error:
Error: SQL46010: Incorrect syntax near TIME.
I have connected directly to the database in Azure and I can use AT TIME ZONE, but I cannot create or publish a DACPAC file from my project.
This SO answer suggests switching the target to SQL Server 2016, but then you cannot deploy the DACPAC to Azure. It will give the error
A project which specifies SQL Server 2016 as the target platform cannot be published to Microsoft Azure SQL Database v12.
when publishing from Visual Studio or the command line with sqlpackage.exe. (Same with all targets).
This seems like a long-standing bug in Visual Studio Data Tools so others must have run into it. Does anyone have a workaround or suggestions?
I found the answer to this through another channel. This is a bug in Visual Studio 16.4 and the current preview of 16.5.
The Visual Studio 16.4 release removed support for Microsoft Azure SQL Database V11. In doing so, they removed the Project target for Microsoft Azure SQL Database V12, making the Microsoft Azure SQL Database the only option. The intention was for this new option to switch to targeting V12, but there is a bug and it still targets V11.
Until this is fixed in a future update of Visual Studio, the workaround is to manually edit the SQLPROJ file and change the line;
<DSP>Microsoft.Data.Tools.Schema.Sql.SqlAzureDatabaseSchemaProvider</DSP>
Adding in V12 to make it;
<DSP>Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider</DSP>
Save and reopen the solution. It now compiles and I can deploy to Azure.
This is the answer just to the second part of the question.
I had the same error while publishing .dacpac from free azure sql database to the one in basic plan.
A project which specifies SQL Server 2016 as the target platform cannot be published to Microsoft Azure SQL Database v12.
I figured that out by checking Allow incompatible platform in Advance setting of Publish Data-tier Application.

Deploying SQL server with VS 2012 application

I'm working on a winform application using VS2012 (.NET 4). I use SQL Server for my database affairs, I can run this application smoothly on my development systems (which have VS 2012 installed) but when I give EXE and my MDF files to someone who don't have VS2012 installed, they get an SQL server exception (also program runs but they cannot use database features), I think problem is that they don't have SQL server installed, how can I solve this problem? what should I give to my users? Is there any difference between Debug and Release versions? I deploy Debug EXE which runs but as mentioned SQL server features are not usable

Embedding SQL Server into a .NET application

Hey, I've just finished writing a VB.NET application. Now I want to package the executable and the database ofcourse into a single installer file. I tried using QSetup, InstallShield to make SQL Server embedded into the setup file, and finally after hours of try&fail I have no idea. Anyone?
You can do a rightmouse on the properties of your Visual Studio Setup Project, and then there is this button 'Prerequisites'. There you can tick 'SQL Server Express ...' Or the 'SQL Server Compact 3.5'
link to image
You're probably best off just to set the connection file directly to the mdf, and attach it when the program is run. This is easier as it doesn't require a custom setup script to install the database to the database directory itself.
Note: Consider using the Compact Version, it's smaller, people don't like a full blown engine on their computer :)
InstallShield has a concept called Setup Prerequisites where you can teach it how to install additional packages along with your own. In older versions this would happen before calling your MSI. In newer versions you can have a "Feature" prerequisite where the prereq can associated to a feature and only installed if that feature is selected to be installed and after it's been selected but still before the main activity of your MSI occurs during the install execute sequence.
InstallShield also has a pattern for executing SQL scripts against your database instance so that you can then load your database into your newly installed instance.
All of this is quite powerful but it does take a bit of digging to learn.
As far as I know, anything but the SQL Server Compact Edition (SQL Server CE) cannot be embedded into your setup, really. Microsoft doesn't want that - you need to have SQL Server Express installed separately - any other edition can't even be shipped with your software (the client must have a license and installation separately).
You can indeed distribute SQL server with your custom application:
http://msdn.microsoft.com/en-us/library/bb264562(SQL.90).aspx

Installing support files for app using sql 2005 where server is on another computer

I have a managed C++ application that connects to SQL Server 2005 Express databases on the same computer and over a network. My problem is that if the database is located on another computer over the network, the client machine will not have the needed DLLs files installed from SQL Server.
I can't force my users to install SQL Server 2005 Express on the client machine just to get the needed support files. So my question is, is it safe to installed the dependent files to the GAC on the user's computer? Or, does MS have a command line install package for just this purpose?
The files from SQL Server that my application show as being dependent on are as follows:
Microsoft.SqlServer.BatchParser
Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.RegSvrEnum
Microsoft.SqlServer.Replication
Microsoft.SqlServer.Rmo
Microsoft.SqlServer.ServiceBrokerEnum
Microsoft.SqlServer.Smo
Microsoft.SqlServer.SmoEnum
Microsoft.SqlServer.WmiEnum
If it helps, I'm using the Inno-Setup program for my installer. This has to be a common problem.
You dont have to install the full version of SQL Server, but you do need the necessary drivers. Installing the SQL 2008 SMO package on the client should resolve these issues.
http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&displaylang=en

Resources