When loading large files – over 100MB with  Sql Server Management Studio 2008 you might get the following error:

Error HRESULT E_FAIL has been returned from a call to a COM component. (mscorlib)  

Large scripts run better with sqlcmd.exe.  Here are some of the parameters for sqlcmd.exe:

Sqlcmd [-U login id] [-P password]
[-S server] [-H hostname] [-E trusted connection]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w screen width]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]

Here is how I ran  mine:

sqlcmd -S .\MYSQLSERVER2008 -U MyUsername -P MyPassword -i C:\Database\hugescript.sql

My huge script file was 1.5GB.  More  on sqlcmd can be found at Microsoft site.

The command line does a better job managing the memory.

Conclusion is:  run larger files with sqlcmd.

Trackback

no comment until now

Sorry, comments closed.