Can I use a .sqlproj file in my .vbproj environment? - visual-studio-2013

I just got VS2013 because I had to do a system restore... unfortunately during the system restore my project's DB files didn't make it over. So, rather than build a LocalDB from my .vbproj environment I decided to manage it in a separate SQL project. The issue I have now is that I can't seem to find a way to USE my .sqlproj as the LocalDB while I'm working on my .vbproj. How do I use my .sqlproj database in my .vbproj file?
I should be able to connect to the localdb with these settings:

AHA!!!! I finally found the answer. I needed to use the right instance of my (localdb). SSDT (.sqlproj) creates an instance called Projects in the LocalDB instead of the default workspace V11.0.
So in the screenshot above I needed to change the "Server Name:" to (localdb)\Projects instead of the generic instance (localdb)\\v11.0. Then it all started to flow together like the magic that it is.

Related

SSIS “Save Copy of …” missing in my Visual Studio 2017

I want to move my SSIS package to a new SQL Server. To accomplish that I installed MS SSDT for VS 2017 successfully on my dev laptop. I opened the SSIS project (which worked fine in VS 2015 on my old dev laptop). I opened the package and went to the file menu hoping to fine 'save a copy of' but it is missing.
It appears 'save as' is not the way to do it anymore. You need to right click the package and select 'deploy', but before I could do that I had to install and reconfigure the environment because my packages hadn't been migrated from sql2014 to sql2016 AND my visual studio 2017 didn't have ssis package support installed and configured. see unsupported below
then you have to convert the deployment model
then right click the package and save to ssis package on sql 2016. but it didn't work because I hadn't condigured ssis on sql server
create a ssis db on sql server
now you can deploy the package
And that will work if your package doesn't use project variables. but if you use variables and converted to project deployment (like I did) then you need to deploy a bit differently because your individual package wont deploy with the project level variables. In this case, You need to click the 'project' item on the menu bar and then click 'deploy' from the DDL. This will deploy all your packages and project variables at once, which is nice. This means that my dtsconfig xml configuration file is no longer in the loop, i.e., its been replaced by the project params. Its also nice because you don't need to manually create the ssis db on sql server, i.e., the project-deploy creates it for you .

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.

Build->Deploy doesn't work for database projects

I have a database project in Visual Studio 2012. When selecting "Deploy MyDBProj" on the Build menu nothing happens.
When I hit F5 to debug however, the database project is deployed, using the settings in the debug section of the database project properties. This is enabled in by checking the "deploy" checkbox in the solution's configuration manager.
I would like to be able to do a deploy, without starting a debug session. How do I do that?
Note: This is not publishing, which is something else. I want to know how to manually initiate the deploy that is part of the build process. Since the deploy is already done automatically it should be possible to initiate it manually too.
I got an answer from Microsoft at MS Connect:
There was a bug in the version of SSDT that shipped in Visual Studio
2012 in wuich the Deploy menu command appears but is a no-op. This has
since been fixed and is available in the latest version of SSDT:
http://msdn.microsoft.com/en-us/data/hh297027
The only way I can think of doing it (though I haven't tested it) would be to use the command line to do it as outlined at http://msdn.microsoft.com/en-us/library/dd193258(v=vs.100).aspx.
Though once you have your manifest, you can run:
VSDBCMD /a:Deploy /dd:+ /manifest:manifestFileName.dbmanifest
from a command line to deploy your database.
The manifest will contain your target database name, connection string, and so on but you can also specify those as part of the command line instead.

How can I manage SQL Server jobs using a Database project

Does Visual Studio 2010 support managing SQL Server jobs in the Database Project?
I am working with a database project in Visual Studio 2010. I would like to manage my database scheduler job in my database project. It seems that I could not create any server object in the database project.
What we do at my company is:
Script out your jobs to be re-runnable (either drop/create or skip if exists)
Place the scripts in your Post-Deployment folder (and include the reference in your Script.PostDeployment.sql file as necessary)
No, you won't be able to do that. If you want to use Visual Studio to manage database projects you can use the database and server projects (what used to be called Data Dude).
You might also want to take a look at Red Gate SQL Connect. It works with databases and source control through Visual Studio.

Error opening the .mdf file to app_data

I am not able to add .mdf file in App_data(vs 2010 visual studio).
If I right click on App_data and try to add existing item and select mydatabase.mdf and click OK I am getting this error:
The file can not be opened because it is used by another process.Please close all applications that might access this file and try again.
But I am just running visual studio.
Not sure if you have found a solution for this, but I just ran into the same problem. I found some relevant info here:
How to add a new database under app_data with SQL Server Enterprise Edition
From this I gather that adding new AND existing databases (ie the .mdf file) via VS2010 is not possible.
I'm assuming (for this answer) that your end goal was the same as mine, i.e. to use the Microsoft Entity Framework to generate a model class from the database.
As I didn't want to install SQL express just to do this my solution was:
-Create any new db via SQL Server 2008 MGMT studio (or a script if you are that way inclined).
-Add a CONNECTION to the database in VS2010
-When adding a new model using the 'Entity Data Model Wizard' select 'Generate from database' and then select your existing connection, and the relevant table(s).
Worked for me!

Resources