General
Apex SQL Audit
Apex SQL Clean
Apex SQL Code
Apex SQL Data Diff
Apex SQL Debug
Apex SQL Diff
Apex SQL Diff API
Apex SQL Doc
Apex SQL Edit
Apex SQL Enforce
Apex SQL Log
Apex SQL Log API
Apex SQL Recover
Apex SQL Refactor
Apex SQL Report
Apex SQL Script
Apex SQL Source Ctl
Apex SQL SSIS Compare
Knowledgebase Home
Apex SQL Audit
Apex SQL Clean
Apex SQL Code
Apex SQL Data Diff
Apex SQL Debug
Apex SQL Diff
Apex SQL Diff API
Apex SQL Doc
Apex SQL Edit
Apex SQL Enforce
Apex SQL Log
Apex SQL Log API
Apex SQL Recover
Apex SQL Refactor
Apex SQL Report
Apex SQL Script
Apex SQL Source Ctl
Apex SQL SSIS Compare
Knowledgebase Home
|
ApexSQL Knowledgebase Tips and How-to Articles for Apex SQL Tools How to use ApexSQL Script C# solutions to execute ApexSQL Diff synchronization scripts DESCRIPTION This article describes how to use ApexSQL Script C# solutions for execution ApexSQL Diff synchronization scripts that will update your database: once compiled you can use the gotten .Net package to update client databases on different machines SOLUTION Before creating a .Net Package that will apply your changes to a database you need a C# solution. To obtain such a solution you can choose among two options: - Download the ready solution from here. Then you can skip the step 1) below - Use ApexSQL Script to create it: then please proceed with the step 1) 1) For the result C# solution created by ApexSQL Script you need at least one SQL Server 2000, 2005 or 2008 available at your network. Then you can use any database (for example, AdventureWorks or master database) to manually create a stub solution as follows: a) Start ApexSQL Script and select any object(s) from any database to script: select a database at the right hand Select Database panel and select an object or objects in the main grid: ![]() b) Run the Script Wizard and select C# Project as Output type: ![]() c) Click the Create button and select the directory where your project will be created: ![]() After the step is passed the stub C# project is created and is ready to use for the next step. 2) If you have already had a ready synchronization script: please skip this step. Otherwise use ApexSQL Diff. a) Start ApexSQL Diff and select necessary databases for synchronization: ![]() b) Using the Project Settings Wizard define necessary comparison options and object filters c) Click the Compare button d) Select the necessary objects to synchronize in the main grid and click the Synchronize tool button to start the Synchronization Wizard ![]() e) In the Synchronization Wizard define all necessary options and then select the Write Script To File Only option at the Output Options Step. Define the directory where your script will be saved. You can save your file in the directory containing C# project made at the previous step: ![]() f) Click the Synchronization button and your script will be created and saved at the chosen folder 3) At this step you should have a stub C# project and a synchronization script you want to apply to your database. To build the .Net package with the synchronization script please proceed with the next steps: a) Open the directory where your C# project is saved. Enter to the directory with your Project name (in the example it is LOCAL@SQL2005.Aworks2005 Installer). Find the file with the *.dat extension. Actually it is a SQL script with objects scripted from the 1) step that can be deleted without a problem. Then find the synchronization script (file with *.sql extension – in the example “Synchronization.sql”) ![]() and rename it to “LOCAL@SQL2005.Aworks2005 Installer.dat”. b) Return back to the main project directory and start the *.sln file. Then Microsoft Visual Studio with this C# project will be opened Now to create a .Net package just build the solution and then it will be ready to use on your environment. AUTHOR Andrew Guselnikov LAST REVIEW DATE 11 June 2008 Labels: Apex SQL Diff, Apex SQL Script ...How do I script my database objects to one output file per object? SOLUTION Scripting your database objects to one output file per object can be done using ApexSQL Script. The steps are discussed below: 1. Create a Project in Structure mode: ![]() 2. Enter your login credentials then select the database(s) you want to script. ![]() 3. In the Object filter, check the object types that you want to script. All object types will be selected by default. Click Connect. ![]() 4. Once connected, all database objects with object type equal to what you selected in the Project Wizard’s Object Filter step will be displayed on a grid. Check each object that you want to be scripted. To script all displayed objects on the grid, right-click the grid and click Check All as shown in image below: ![]() 5. Once all objects are selected, click Script Wizard from the Outlook bar found on the left side of the interface. ![]() 6. In the Script Wizard, you will be presented with various scripting options. You can change them as required. To script just the DDL of the db objects (data not included), select Structure Only in Scripting Mode. ![]() 7. To produce one script file per object, click the File node of Script Wizard and select Script Each Object to an Individual File. You can use the Filename Template step to set how you want your script files to be named. In example below, {objectname} is used. Your script files will then have ObjectName.sql filenames. ![]() 8. Specify the folder where you want to save your scripts. ![]() 9. Click Create. The scripts per individual object will be saved at the folder you specified. ![]() AUTHOR Irene Sanford LAST REVIEW DATE 02 June 2008 Labels: Apex SQL Script ...How to use ApexSQL Script to deploy a database as a .Net executable DESCRIPTION ApexSQL Script allows you to script your SQL Server Database structure and data and compile it into a .Net executable. This executable can be run from any pc without the need to have the SQL Server client tools installed. SOLUTION To create a .Net executable, select .Net package as your output type in the Script wizard: ![]() Selecting the output type determines the various customizable output options. For a .Net executable, you can configure the output processing options: ![]() Checking the “Use Compression” option will cause ApexSQL Script to try to reduce the size of the executable by using .Net algorithms. The “Run Executable Now” option simply means that the exe will be invoked the moment it has been compiled The Error handling step determines how errors will be handled when the package is executed. For .net executables the errors are handled internally which gives the package greater control and allows you select from the follow options for the treatment of errors: ![]() • Abort All changes which have been applied so far will be rolled back. • Ignore Errors will be ignored and the package will proceed as if nothing happened. • Ask for confirmation A message box will appear when an error is encountered to allow the user to select the appropriate action. ![]() You can also set the default database properties for the package: ![]() If you check the “Indicate Default Database” option, a default database will be recommended on the connection screen when you run the executable: ![]() ApexSQL Script also allows you to customize the details of the About Box: ![]() This information is then displayed when the About button is clicked on the Installer: ![]() Clicking on the create button will then create a .exe file.To run the newly created package, double click the .exe in explorer: ![]() This opens the installer: ![]() You can create a new database or edit an existing database. Once you have entered the connection details of the database you want to create or edit, click "Run". This will execute the package and create or edit the database, using the script generated by ApexSQL Script: ![]() You can verify that the database has been created using SQL Server Management Studio: ![]() AUTHOR Minette Steynberg LAST REVIEW DATE 01 September 2007 Labels: Apex SQL Script ...Welcome to the ApexSQL Knowledge Base Welcome to the ApexSQL Training Knowledge Base. Here you'll find tips, reviews, videos, and articles on how to get the most out of ApexSQL Tools and Microsoft SQL Server. Labels: Apex SQL Data Diff, Apex SQL Debug, Apex SQL Diff, Apex SQL Edit, Apex SQL Refactor, Apex SQL Script, Apex SQL SSIS Compare, ApexSQL Clean, ApexSQL Code, ApexSQL Doc ... |
© 2008 Apex SQL Tools All Rights Reserved | 1.919.968.8444 | Contact Us | Terms of Use | Privacy Policy

























will then create a .exe file.


