I recently faced an situation, where i was supplied with a .SQL file which was exported from a large table with some million records. The file was exported from the generate script options of SSMS and had the insert statements. The size of the file was more than 2GB.
SSMS(SQL Server Management Studio) is not capable enough of handling such big files. It would through one following error:
SQLCMD is the life saver here. We could use SQL command line utility to execute the T-SQL commands. It is pretty simple to use as detailed below:
The difference: SSMS uses the .Net framework for execution where as the command line uses ODBC driver.
SSMS(SQL Server Management Studio) is not capable enough of handling such big files. It would through one following error:
- Insufficient memory to continue the execution of the program.
- or SSMS would simply reject the request to open the file.
SQLCMD is the life saver here. We could use SQL command line utility to execute the T-SQL commands. It is pretty simple to use as detailed below:
- Open the Command prompt with the administrator privileges.
- Execute the following command.
sqlcmd -S SQLSERVER\InstanceName -i "F:\File.sql"
The difference: SSMS uses the .Net framework for execution where as the command line uses ODBC driver.
No comments:
Post a Comment