Automation of SQL Server Migration with selective table truncation - sql-server

Just wondering if any SQL Server experts out there have any tips that can help in my testing of a MS-Access port to SQL Server using the Migration Assistant and with selective Drop+Create SQL scripting.
I have a new SQL Server database that I'm migrating from a total of 5 external MS-Access databases. The one database gets changed daily and I'd like to update my test SQL Server with new data every once in awhile
My problem right now is that I don't want to Drop + Create the whole database.
I'd just like to selectively drop the tables being migrated in from the one MS-Access database.
I can't see an option for that inside SQL Server. Is there a tool or menu item that I missing?
I'm using SQL Server 13.0 (2017) and I have SQL Server 2016 Import/Export Wizard

Not sure if I'm missing something.
Create a SQL script, that you run before running the import.
-- Drop all tables imported from Access database x
DROP TABLE foo;
DROP TABLE bar;
-- etc
GO
To avoid typing all the table names, see e.g. list of tables without indexes in sql 2008
Or use MSysObjects in the source database.

Related

Link SQL-Server tables to MS Access file

In my SQL Server database I need to mantain the tables linked and in sync with the tables of an MS Access .mdb file.
Lets say I update something or add something in the MS Access database via my own application.
I want those changes reflected in the SQL Server database.
I need a way to push the updates to the SQL Server database, or a way to update the SQL Server database with the new data when I connecto to it.
Trying to be clear: source must be the .mdb file database and destination must be the SQL server database. I need to keep them in sync.
Both databases have the same tables.
I have read a lot of posts, even this one: From SQL Server how do I read from an MS Access database to UPDATE data in one or more table columns? that seems to be the solution, but I can figure out the steps.
The official tool for this is:
SQL Server Migration Assistant for Access (AccessToSQL)
It has a migration feature that, when run, will replicate (adjust) the table schema in the database in SQL Server to match that of the Access database.

MS Microsoft SQL Server Management Studio - Import/Export-Database with Default Value or Binding

I am using the Microsoft SQL Server Management Studio to clone a database and its tables and data (which runs a MS SQL Server 2008) to a new one (which runs a MS SQL Server 2012).
I know there is the possibility to do so with
"Tasks->Import Data"
and the transfer worked fine for the tables and the data of the tables. Sadly the old database also has set "Default Value or Binding"-Properties for some columns. These seem to have been lost during the transfer. Is there a way to tranfer these values as well?
Try to a create a "create script" for your source table and use that script to create your target structure. Then you can copy the data using the import wizard.

restore a sqlserver 2005 database into sqlserver 2012

I have a db running on an instance of sqlserver 2003, Ive tried to import it into sqlserver 2012 but that wont work it's says it's to old.
so I've imported it into sqlserver 2005, I have then backed it up again and tried to import it into sqlserver 2012 but it comes up with the same error.
I can restore other db's from sqlserver 2005 so I can only presume its keeping its 2003 settings when I back it up.
Can anyone help
I suspect that your database might have some deprecated functionality that prevents your upgrade from working.
There's a list of deprecated functionality between SQL Server 2000 and SQL Server 2005 on technet.
I would strongly advise you to use the SQL Server 2005 Upgrade Advisor to identify such functionality, and address any potential issues. Then, and only then you should have a database compatible with SQL Server 2005, and can (hopefully) proceed from there.
if u want database structure only then take database script then run into sql server 2005, if u want database with data also mean
right click the Database go task
click Generate Script
There Two options entire database or with specific objects
entire database for DataBase structure only
with specific objects - select all objects then click Next you find the Advance button then click it.
scroll down and Find Type of Data Scripts click and change to Schema and data then you will save as file file or new query window
this is one of the method to restore the database.
Set your compatibility level to (90) Sql server 2005 in your database properties after restoring.

Migrate SQL Server 2000 data to SQL Server 2008

I want to migrate 2 database from my old SQL Server 2000 to my new server with the 2008 version.
I do that with the Management Studio 2008 with the export data task. It works fine and no error occurs but in the database on my new server all primary keys are missing.
Did anyone knows why or has another idea how to solve my problem.
When you get to the Select Source Tables and Views step of the export wizard you need to do Edit Mapping for each selection, then select Enable Identity Insert. If you don't check this option the primary key values are not exported.

SQL Server 2000/2005 - Maintaining Development Version and Production Version

I am used to using Oracle Designer by creating database object definitions, then creating DDL SQL required by connecting to a database instance.
For eaxmple, when adding a new column to a table, first I add it to the table definition, then generate the DDL SQL against the development version and run it, then after testing I point to the Production instance to create the missing column in Production.
Given that there is no Designer in SQL Server what is the correct procedure to say add a column to both database instances? Is there a tool for keeping the schemas in sync?
RedGate offer a product called SQL Compare, that can be used to script out the differences between different databases.
See: http://www.red-gate.com/products/SQL_Compare/index.htm
You could also use the Database Diagrams within SQL Server Management Studio to design your database schema however this would be constrained to within a given database.
There isn't a built in tool for keeping them in sync (that I know of), but RedGate has some commercial apps for this.
What do you mean there is no designer in SQL Server? Are you using SQL Server Management Studio?

Resources