Feedback

  • Contents
 

Step 8: Import the SQL Files

At this point, Microsoft SQL Server is running and you can batch-import an entire folder of .SQL files. This section describes one method, using the "sqlcmd" tool included in Microsoft SQL Server.

  1. Create a batch file named import.bat, in the same folder as the generated .SQL files.

  2. Add the following line to the batch file, where you provide appropriate values for {server}, {database}, {user} and {password}:

    Note: Type this command on a single command line with no line breaks:

    for %%i IN (*.sql) Do sqlcmd -S {server} -d {database} -U {user} -P {password} -i "%%i" >> import.log

  3. Run the batch file.

  4. Check the import.log file to ensure that no errors occurred. The generated SQL files are now in the database.