title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | ms.collection | f1_keywords | helpviewer_keywords | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Loading Converted Database Objects into SQL Server (AccessToSQL) |
Loading Converted Database Objects into SQL Server (AccessToSQL) |
cpichuka |
cpichuka |
01/19/2017 |
sql |
ssma |
conceptual |
|
|
|
After you have converted Access database objects to [!INCLUDEssNoVersion] or SQL Azure, you can load the resulting database objects into [!INCLUDEssNoVersion] or SQL Azure. You can either have SSMA create the objects, or you can script the objects and run the scripts yourself. Also, SSMA lets you update target metadata with the actual contents of [!INCLUDEssNoVersion] or Azure SQL Database.
If you want to load the converted database objects into [!INCLUDEssNoVersion] or SQL Azure without modification, you can have SSMA directly create or recreate the database objects. That method is quick and easy, but does not allow for customization of the [!INCLUDEtsql] code that defines the [!INCLUDEssNoVersion] or SQL Azure objects, other than stored procedures.
If you want to modify the [!INCLUDEtsql] that is used to create objects, or if you want more control over objects creation, use SSMA to create scripts. You can then modify those scripts, create each object individually, and even use [!INCLUDEssNoVersion] Agent to schedule creating those objects.
To use SSMA to create [!INCLUDEssNoVersion] or Azure SQL Database objects, you select the objects in [!INCLUDEssNoVersion] or SQL Azure Metadata Explorer, and then synchronize the objects with [!INCLUDEssNoVersion] or SQL Azure, as shown in the following procedure. By default, if the objects already exist in [!INCLUDEssNoVersion] or SQL Azure, and if the SSMA metadata has some local changes or updates to the definition of those very objects, then SSMA will alter the object definitions in [!INCLUDEssNoVersion] or SQL Azure. You can change the default behavior by editing Project Settings.
Note
You can select existing [!INCLUDEssNoVersion] or Azure SQL Database objects that were not converted from Access databases. However, SSMA will not re-create or alter those objects.
To synchronize objects with SQL Server or SQL Azure
-
In [!INCLUDEssNoVersion] or SQL Azure Metadata Explorer, expand the top [!INCLUDEssNoVersion] or SQL Azure node, and then expand Databases.
-
Select the objects to process:
-
To synchronize a complete database, select the check box next to the database name.
-
To synchronize or omit individual objects or categories of objects, select or clear the check box next to the object or folder.
-
-
After you have selected the objects to process in [!INCLUDEssNoVersion] or SQL Azure Metadata Explorer, right-click Databases, and then click Synchronize with Database.
You can also synchronize individual objects or categories of objects by right-clicking the object or its parent folder, and then clicking Synchronize with Database.
After that, SSMA will display the Synchronize with Database dialog, where you can see two groups of items. On the left side, SSMA shows selected database objects represented in a tree. On the right side, you can see a tree representing the same objects in SSMA metadata. You can expand the tree by clicking on the right or left '+' button. The direction of the synchronization is shown in the Action column placed between the two trees.
An action sign can be in three states:
-
A left arrow means the contents of metadata will be saved in the database (the default).
-
A right arrow means database contents will overwrite the SSMA metadata.
-
A cross sign means no action will be taken.
Select the action sign to change the state. Actual synchronization will be performed when you click OK button of the Synchronize with Database dialog.
-
If you want to save [!INCLUDEtsql] definitions of the converted database objects, or you want to alter the object definitions and run scripts yourself, you can save the converted database object definitions to [!INCLUDEtsql] scripts.
To save one or more objects to a script
-
In [!INCLUDEssNoVersion] Metadata Explorer, expand the top node (the server name) and then expand Databases.
-
Do one or more of the following:
-
To script a complete database, select the check box next to the database name.
-
To script or omit individual views, expand the database, expand Views, and then select or clear the check box next to the view.
-
To script or omit individual tables, expand the database, expand Tables, and then select or clear the check box next to the table.
-
To script or omit individual indexes for a table, expand the table, expand Indexes, and then select or clear the index.
-
-
Right-click Databases and select Save as Script.
You can also script individual objects. To script an object, regardless of which objects are selected, right-click the object and select Save as Script.
-
In the Save As dialog box, locate the folder where you want to save the script, enter a file name in the File name box, and then click OK.
SSMA will append the .sql file name extension.
After you have saved the [!INCLUDEssNoVersion] or SQL Azure object definitions as a script, you can use [!INCLUDEssManStudioFull] to modify the script.
To modify a script
-
On the [!INCLUDEssManStudio] File menu, point to Open, and then click File.
-
In the Open dialog box, locate and select your script file, and then click OK.
-
Edit the script file by using the query editor.
For more information about the query editor, see "Editor Convenience Commands and Features" in [!INCLUDEssNoVersion] Books Online.
-
To save the script, on the File menu, select Save.
You can run a script, or individual statements, in [!INCLUDEssManStudioFull].
To run a script
-
On the [!INCLUDEssManStudioFull] File menu, point to Open and then click File.
-
In the Open dialog box, locate and select your script file, and then click OK.
-
To run the complete script, press the F5 key.
-
To run a set of statements, select the statements in the query editor window, and then press the F5 key.
For more information about how to use the query editor to run scripts, see " [!INCLUDEssManStudioFull] [!INCLUDEtsql] Query" in [!INCLUDEssNoVersion] Books Online.
You can also run scripts from the command line by using the sqlcmd utility, and from [!INCLUDEssNoVersion] Agent. For more information about sqlcmd, see "sqlcmd Utility" in [!INCLUDEssNoVersion] Books Online. For more information about [!INCLUDEssNoVersion] Agent, see "Automating Administrative Tasks ( [!INCLUDEssNoVersion] Agent)" in [!INCLUDEssNoVersion] Books Online.
After you have loaded the converted database objects into [!INCLUDEssNoVersion], you can grant and deny permissions on those objects. It is a good idea to do this before migrating data to [!INCLUDEssNoVersion]. For information about how to help secure objects in [!INCLUDEssNoVersion], see "Security Considerations for Databases and Database Applications" in [!INCLUDEssNoVersion] Books Online.
The next step in the migration process is migrate data into SQL Server.