I’m in my finale stage in my cleanup project of the 26GB database for a customer. Today, I planned for working late from home. My problem was that my data script had a “use <db name> – included by a mistake. The script files were too large to edit with available tool on the database servere and my broadband connection isn’t good enough to transfer the files between the server and my laptop that has the proper tools.
The solution was a quick look at the SQLCMD command line options. After some frustrating minutes, I spotted the -d <db name> option. I tried it on my local machine and it work perfectly.
As a result, i could load my large script (8gb for largest table) and override the use statement in the script file.
sqlcmd -d <database> -i <script file>