How to use SQL Server 2008 Database project in installation time - sql

I have created SQL Server 2008 Database project using visual studio 2010. after build and deploy this project i saw dbschema file that contain SQL queries that i use to create my database inside the XML tags. And there is another .sql file(This file also contain that sql queries. but there is no XML tags)
In this 2 files i want to know what is the file that i can use to create database in installation time and how to execute that file in installation time.
I found some details from http://msmvps.com/blogs/deborahk/archive/2010/05/02/vs-2010-database-project-an-introduction.aspx
Hope you guys can help me to get some solution.

To deploy the database project you just need to .dbschema file.
If your database is composed of multiple .dbschema then you have to deploy using the manifest.
The tool you need is vsdbcmd.exe in VS 2010. It works with SQL 2008. It does not work in SQL 2012.
Check out the following link on how to do it.
http://msdn.microsoft.com/en-us/library/dd193283.aspx

Related

How to create a database project in Visual Studio 2013

I'm migrating a solution which contains some C# projects from Visual Studio 2008 to VS2013. The migration went fine, with a few adjustments, but there's also a .dbp project (database project, from VS2008), which refuses to migrate / load in VS2013.
The closest project type I found in this newer version is "SQL Server Database Project", I've created one and added my existing .sql script files, but this project type (.sqlproj) appears to be something different. For example, VS 2008's "database project" does not build. Also, I had a hard time trying to add a reference to my existing SQL database running under SQLExpress.
I've also set BuildAction = None to all my script files, and now I can open each of them manually and execute. But still, I'd like to select multiple files and execute them all at once. Seems I'm missing something.
So, is there a way to accomplish that?
I suggest you look at the following article to convert the dbp to dbproj: MSDN
And after that look at the following link to convert dbproj to sqlproj: Tentacle Software Blog

How to create installer for my visual basic project with sql server 2008 database?

Hi guys I have a visual basic project and I developed it using visual studio 2010 and sql server 2008 for my database.
Now, I want to make an installer that will include my sql server database.
I just used software ADVANCES INSTALLER but it didn't work out.
Help guys. Thanks in advance
Note: Can I make it like InFLOW inventory System installer? It's using also sql server database. Just hoping.
I use Advanced Installer for several years and for deploying database files I use their SQL Databases page. For example, for attaching an MDF file to an SQL instance you can add the MDF file in "Files and Folders" page and use, in SQL Databses page, a script like this.
You can check out this tutorial to get a starting point about how you can configure the SQL Databses page in Advanced Installer.
Hope this info is useful.

Databases and Visual Studio 2013

I am collaborating on a project with several other people in Visual Studio 2013. We are using Tortoise SVN to share the project so that we are all working on the same files. I was in charge of constructing the database, which I did. But after making the database in the SQL Server Object Explorer under (localdb)\Projects(SQL Server 11.0.3000-THE-DRAGON-DEN\Dragonfett), I can not seem to find the database in the solution folder for the project.
How do I get the database into the project folder?
That is merely a link to a SQL Server database.
If you want the database in the solution folder then you will need some form of project. SQL Server Data Tools (SSDT http://msdn.microsoft.com/en-us/library/hh272686(v=vs.103).aspx) is what you are looking for. AFAIK this is installed with VS2012 and VS2013. For VS2010 you will need to install SSDT manually.
Select File->New->Project and in the templates look for SQL Server Database Project under the SQL Server Template group. SSDT has a great import facility which will let you import the contents of an existing database with no fuss. SSDT as a project can then be checked into and controlled by SVN.
Other that that, Installing, configuring and using SSDAT is beyond the scope of the question. I would suggest you do a bit of homework and read up on SSDT and how it works.

Latest recommendations for Import\Export of SQl Server bacpac files [duplicate]

This question already has answers here:
Azure SQL Database Bacpac Local Restore
(6 answers)
Closed 9 years ago.
I'm trying to get up and running with Windows Azure but finding the database side extremely frustrating. I need to export my local database to a bacpac file from SQL 2008 and then import into Azure. I would also like to be able to export from Azure and then import to my local database for debugging.
I have found a few tutorials online for achieving this but every time I get part way through one of them I eventually hit a section that requires a step where the information or download is marked as outdated! it seems to have changed quite a bit over time and I can't find an up to date resource
Can anyone provide an updated link on how to do this?
Thanks
I had the same issues, all documentation on importing/exporting .bacpac mostly reference SQL 2012. I needed to export a sql 2008 R2 express database to azure as well as to be able to export from azure to my local devlopment environment.
I found the SQL Database Migration Wizard v3.9.9 & v4.0.12 to do the trick.
Download Link: http://sqlazuremw.codeplex.com/releases/view/32334
Also download the documentation and it will go through the migration of .bacpac to and from the azure and your local server. What is great about the tool is it will perform a compatibility check on the database to ensure it is ready to deploy to azure.
There is also another command line tool I investigated sqlpackage.exe that can be downloaded as part of Microsoft SQL Server Data Tools
Download Link: http://msdn.microsoft.com/en-us/data/hh297027
Below is an example of exporting a .bacpac file:
sqlpackage.exe /a:Export /ssn:SERVERNAME\sqlexpress /sdn:SOURCEDATABASENAME /su:DATABASEUSER /sp:DATABASEPASSWORD /tf:c:\SOURCEDATABASENAME.bacpac
I needed to export a SQL Azure database and then import it into a local SQL 2008 R2 server (Note I am also using Visual Studio 2010). Microsoft certainly went out of their way to make this a painful task, however, I was able to do it by doing the following:
Goto think link http://msdn.microsoft.com/en-us/jj650014 and install the SQL Server Data Tools for Visual Studio 2010
This will install on your local drive. In my case here is where it put it: C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin
Browse to this via the command line or powershell
You are going to want to execute the SqlPackage.exe
Open up this link to see a list of all the parameter options for SqlPackage.exe (http://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx)
Here is my command line that I needed to execute to import a .bacpac file into my local SQL 2008 R2 server:
.\SqlPackage.exe /a:Import /sf:C:\mydatabasefile.bacpac /tdn:NorthWind /tsn:BINGBONG
/tdn is the name of the database you want your bacpac file to restore to.
/tsn is the name of your SQL server.
You can see all these parameter descriptions on the link from #5.

How to get a changeset SQL query using DB Pro for .net and SQl Server when usinga Team build?

I am working on Build Automation via Team Build (TFS 2008). We are using DB Pro with our Web project.
I want to get the SQL script for database change-set ,(that has occurred till the nightly build), automatically using MSBuild Script . This script has to bundled in a zip file along with Web Application binaries and pages.
How can i automatically generate Database change-set(changes of tables and data that occurred since last change-set) in the form of a SQL script that can be executed any SQL Server database(SQL Sever 2000 or 2005 at the minimum).
kindly help.
Thanks.
The easiest way is to automate db deployment on specified database, and after that copy the created script to your package (if you're using VS 2008 DB Pro Edition)