How to import saved SQL scripts to an SQL Server database?
There are two methods of saving recovered data generated by SQL Server Repair Toolbox:
SQL scripts can differ regardless of the fact that they may be based on the same database files. This is related to certain syntax peculiarities in requests that are executed after establishing a server connection via ADO, as well as the execution of SQL queries in Query Analyzer shipped with Microsoft SQL Server (use of “:”, Go commands, etc.).
1. Conversion of recovered data to SQL scripts and saving them on the hard drive
If you chose to save data to the hard drive, the program will automatically create a subfolder that will, in turn, be created in the folder specified by the user. All the scripts will be saved there. The names of the scripts being created comply with naming rules and consist of letters and digits, where words denote the script’s role, and digits refer to its number. There are numerous script types, for example:
The serial numbers of scripts are used for separating data and saving it to a multitude of small documents instead of one large file. It should be noted that each new file of the “Data” type can include data from one table only.
Attention: numbers may be missing in some files, which means that data is missing in some tables or it’s far from being complete.
You can see the recommended execution sequence in the illustration below:
The sequence of script execution depends on existing restrictions for the current data and table structures. Please pay special attention to these factors:
The install.bat file is created to ensure automatic script execution. This file launches all the scripts that were previously saved by this program. The script execution sequence will be the same as when scripts are executed on a database. This batch file requires the isqlw tool to be installed, which is included in the client part of MS SQL Server. Please specify such parameters as “Server name”, “Database name”, “User name”, “Password” in the command line. For example: install.bat SQLServer SQLDatabase SQLUser SQLUserPassword.
- Parameters should be specified through spaces. If one of the parameters contains a space, you need to specify it in double quotes.
- Can’t swap parameters.
If the install.bat file is started without parameters, you will see a small instruction on launching this file.
If you authorize in Microsoft SQL Server via a Windows account, use the InstallTrusted.bat file. InstallTrusted.bat has 2 parameters: Server name, Database name.
Example: installtrusted.bat SQLServer SQLDatabase Detailed information about authorization via a Windows account can be found here: http://msdn.microsoft.com/en-us/library/ms181127.aspx