How can I transfer tables from one SQL Server database to another? - sql-server

I have 2 SQL Server database files .mdf on 2 different projects in Visual Web Developer Express Edition 2010, I need to make them one database by taking the tables of one database to the other database.
I use the built in development server of Web Developer and I don't have SQL Server installed separately on my system.
So how can I do that ? Do I need special tools or this can be done with web developer ?
Thanks

Check out the database publishing wizard. It should let you generate scripts for the entire database and then you can just run those scripts in your new db.

Related

Why do I need SQL Server to install Azure DevOps?

I'm currently working on a enterprise that uses TFS 2017, and we pretend to upgrade to Azure DevOps. So far I'm just studying about how to implement this TOOL. I'm new on devops things and I have these following doubts... Why do we need SQL Server to install DevOps Azure? What kind of information are stored in there?
In the server configuration wizard, I have the option to select an existing database to use for the Azure DevOps Server that's being deployed... Can I select the currently database that's used by TFS 2017?
Azure DevOps Server and Team Foundation Server store just about everything in massive SQL Server databases.
The main server configuration is stored in the tfs_configuration database and each project collection is stored in a separate database The default is tfs_defaultcollection.
The collection database holds all version controlled files (TFVC and Git), all work items (Product Backlog, Sprints etc), Test Cases and all test run attachments, your Pipelines, Builds and Releases as well as all of the artifacts produced by these pipelines.
These databases can grow considerably.
Whether you can keep your current database server depends on what version you're currently running. SQL Server 2016 SP1+ happens to be supported by both Azure DevOps Server 2020 as well as Team Foundation Server 2017. You could keep using that for the upgraded installation.
But my recommendation would be to install SQL Server 2019, you'll get all of the performance and security benefits of the new server, support for the latest Windows Server platform, as well as a support window that matches your new Azure DevOps Server installation.
You can find the SQL Server compatibility matrix for TFS/ADS here:
Azure SQL Database and SQL Server
TFS 2017 was one of the last versions to require a database for the Warehouse, which is a form of replicated data. Reports can be written to pull data from the warehouse, without impacting the user experience. The database is somewhat deprecated now, especially for reporting. Microsoft promotes the use of the API to pull data from the live database. TFS does however still need its "live" database to store all of the data presented to users. These will be work items, discussion comments, project templates, user mappings to AD, amongst other things.
You will need to upgrade your 2017 Schema to conform to the new standard as defined by Azure, which will be taken care of as part of the upgrade.
What kind of information are stored in there?
Issues, templates, build results, lots of things.
Can I select the database that's used by TFS 2017?
Yes, that will be upgraded during the installation.

Migrate SQL database from 2014 to 2012 version - mvc codefirst

I'm developing a project with ASP.net-MVC and as it's Model first, it generates the .mdf and .ldf files of database automatically. and database is in version of 2014. when I wanted to upload it on host server they told me that they don't support upper version of 2012. so I need to migrate my data base from 2014 to 2012 version.
my data base is not that much big. and I follow this article
https://www.mssqltips.com/sqlservertip/2810/how-to-migrate-a-sql-server-database-to-a-lower-version/
step by step but no diffrence happend to my database version. its still Product Version:12.0.2000.8
really appreciate you'r help. thanks
You develop the database based on the Model First, so you have all control in generation /modifying the database.
You needn't to migrate the database, but in visual studio you can re-generate the database in sql server 2012.
To Generate the database in sql 2012, do the same steps you follow to generate database for sql 2014 in visual studio, just for reminding:
In the EDMX design surface, right click ->Generate database from the model
Follow the wizard and create a new connection to sql2012.
At end of the wizard, a new database is created in sql server 2012.
Sql script is also auto generated named e.g. model.edmx.sql including all DDL of the Entity and associations,...
Exute that script within VS, you can select the connection and executing the script in the new database server 2012.
For the data, you can use the bcp utility or the export wizard in SSMS.
Update:
In the Model First approach, you create a diagram that will be automatically converted to a coded model and the model is saved in EDMX (xml file).
If there is no EDMX in the project, it means that you didn't use the ModelFirst approach, but you may used a template of MVC project which auto generate database at the start of the project.
The benefit of the Model First is the ease of change and sync between development Environment and the production for future changes.
You can re-engineer your project and add ModelFirst approach even you created a database.
From there you can re-create the database in the sql server 2012.
I describe step by step tutorial to build your mode:
Building DataModel from Existing Database in EntityFramework 6 For ModelFirst Approach
Compatibility Level should be set to SQL Server 2012(110) before to following the steps https://www.mssqltips.com/sqlservertip/2810/how-to-migrate-a-sql-server-database-to-a-lower-version/
To change the compatibility level go to database properties->Options->Compatibility Level
When you run the output script, it should be run on the target server (2012). Backups on recent versions cannot be restored on earlier versions.
Take a look here
The setup will change your database from 2014 to 2012.

Where does SharePoint 2003 store actual farm database configuration?

Migrating a 2003 SharePoint farm from an old SQL Server 2005 install to a SQL Server 2012 install on a separate server.
We recently lost our SharePoint expert, so since me the DBA uses Microsoft products it shouldn't be that much of a leap right?
I can't for the life of me find the actual farm database configuration in SharePoint. I will need to change the connection string(if it uses such a thing) to point to my new database server after I detach and attach the database files.
It might be better to move the content databases over, and then re-run the SharePoint Technologies Wizard and create a new config database. Once done you can recreate the applications and re-add the content databases. I have had to do this after upgrades / failed patches, config corruptions etc. With an upgrade, you will also want to run the tool again to update the database schemas to the latest version.

Deploy standalone database

I create an application and use SQL SERVER 2008 R2 as its database. How I will deploy my application in a standalone computer without attaching the database? Is it possible to do that ?
Incase you don't want to install sql server on client side,you need to change database to any document database.you may go for sqlite http://www.codeproject.com/Articles/22165/Using-SQLite-in-your-C-Application

How do you work with SQL Server CE and SQL Server 2008 Express?

I have installed:
Visual C# 2008 Express
Visual Web Developer 2008 Express
Visual Studio 2008
SQL Server 2008 Express
SQL Server Management Studio
In Visual C# 2008 Express, I can "Add Item" and create a "Local Database" (.sdf file) or a "Service Based Database" (.mdf file).
Visual Studio 2008 is the same as Visual C# 2008 for applications but in Websites, the only way I can create .sdf or .mdf files is via the Database Explorer.
In Visual Web Developer 2008 Express, however, I can "Add Item" and ONLY create a "SQL Server Database" (.mdf file). Even the Database Explorer doesn't offer to create a SQL CE database.
Questions:
why the discrepency between the applications, is this normal or did something go wrong with my installations?
I never "installed SQL CE", where did it come from and how is it that I am able to create .sdf file?
How do you work with these in projects on a day to day basis, do you use Visual Studio to edit the databases or do you use SQL Server Management Studio?
I believe only Professional and above may create MSSQL CE databases.
SQL CE is installed with 2008 studio, I was surprised to see it myself and didn't see an option to exclude it.
Personally I use VS 2008 to add items to my project databases. Since it's open anyway I just use it. It provides most of the same functionality as Management Studio. If I am doing separate database work, I usually do it in Management studio.
The CE databases are pretty useless. They have a limited sub-set of types and functions. They do not support views or stored procedures. Basically they only store tables; I haven't attempted to create foreign keys in them.
There is no way to rename tables or columns. You must create a new table.
Once you create your database it must be manually added to your project.
You cannot directly create a LINQ to SQL class in VS2008 on a CE database. You need to use the command line tool sqlmetal (called from .NET console) to create the class for you.
I've had issues where the Class created for a CE database didn't work like a class built for a regular SQL database. Because of this I abandoned using a CE database all together.
It would be nice if there was a reliable way to use Linq to SQL on SQLite databases. SQLite is a great self-contained database not requiring any type of external engine.
Sorry I don't have any performance statistics for an SQL CE database.
I hope this is somewhat helpful.
Brett
Ok registered now and not sure why got a -1 vote on previous answer but will expand.
Web Developer Express 2008 Does not create or work with Sql Server CE simply because SQL Server CE is not designed to work on the Web Server.
When you load c# express or vb express. sql server express 2008 is offered to be installed. SQL CE isn't installed. if you go and add a data source the two I know will be there, Microsoft SQL Server Compact 3.5 (.NET Framework Data Provider for Microsoft SQL Server Compact 3.5)and Microsoft SQL Server Database File (SqlClient), the access client may be there also.
It should be noted with a default Express setup that if you choose to use the data provider for sql server compact it will fail even though it is an option. you would have to download sql server ce separately to create sdf databases.
Also Express versions are targeted to a different audience and doesn't have the same ui setup as the main vs sku's have. For example Web express in database setup doesn't even offer the choice to use sql server ce. while in VS it is a choice from the data menu mainly because VS supports more than just web developer.
Now you said you loaded VS 2008 (didn't say what version but doesn't matter since this affects standard and above)
The default install for vs 2008 will install Sql server ce (and as previous answer stated 3.1 was with rtm, 3.5 was with sp1). you can turn it off in advance options.
One concern I have is that you mention that you can't create a database in vs on web projects. which template are you using. You should be able to create server based database Items in add item and both local and server database objects in the data tab.
so in Summery.
on client based express skus and client based projects you should be able to create a local or server based database from add item and from the data tab.
Since sql CE is not officially supported on the Web Server. on the web skus in add Item you should only have access to create a server based database. on express since it is a dedicated sku CE isn't an option in either the data tab or the add item. on vs you can create a CE database from the Data tab. and you should have access to create a server database in add item.
sql server management studio doesn't care where the source is. so it will work with all and create the database.
I use all the options listed just depending on what or where I am at the time. as was mentioned CE on the desktop is primarily a cache database perfect for offline database support. but does have its limitations and in addition really needs better integration. once I am created or working with a database in support I primarily use management studio.
The key point in why you can't access CE from Web express is that CE is not supported on the web server.
Douglas
This is normal. The database types supported by the Visual Studio designer differ by edition. Note that any version of Visual Studio can write and use code that connects to any of those databases. It's just that the visual "wizard" tools included with the IDE that walk you through it are different for each edition.
SQL CE is the Compact Edition of sql server. It's intended for use on portable devices like smart phones or as an Access replacement for a local data store in desktop apps. It's very portable: only 2 dlls that clock in at less than 1Mb of disk space, and was probably included with at least one of your Visual Studio packages, probably all of them.
I normally do all my database work from Management Studio, but that's a personal preference.
The discrepancy is odd, but since SQL CE is a plugged-in item, it may well be that the team didn't test every possible scenario and some of the applications simply didn't get the info they needed to know that it's there. I'm not saying that anything went wrong - it may simply be a scenario that the SQL CE team never tested.
SQL CE was installed with Studio (can't recall offhand, but I think 3.1 shipped with the RTM and 3.5 shipped with SP1).
I always use Management Studio for making database modifications (except those done directly in code).

Resources