arthurh88
asked on
how to run a large SQL Query? "Insufficient memory"
I have a 50MB .sql file. It loads easily enough into SQL Management studio but I cannot execute it, it spits out an error that there is insufficient memory to parse the script. Any ideas how I can run this?
SQL 2008
SQL 2008
Couple of things that come to mind..
Split the script into "bite-sized" pieces.
50 MB SQL File? Are you inserting or creating a ton of data? It would be recommended to insert or link to the other database if you are using temp tables.
SELECT TOP 1 from Table
would trim down the results.
HTH,
Kent
Split the script into "bite-sized" pieces.
50 MB SQL File? Are you inserting or creating a ton of data? It would be recommended to insert or link to the other database if you are using temp tables.
SELECT TOP 1 from Table
would trim down the results.
HTH,
Kent
ASKER
yes they are 80,000 insert statements. i dont know what you mean by BCP it or how to load it into a text file, other than renaming it to .txt....?
it is a ZIP CODE database that i just purchased for 140 bucks.
it is a ZIP CODE database that i just purchased for 140 bucks.
ASKER
i guess i could cut and paste chunks of it at a time, but PLEASE tell me there is an easier way lol
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did you get your database (that you purchased) by chance just like that SQL, or did they also give you an Access version of it? Because if you got an Access database of it, you can export that right into SQL Server.
BCP would be good.. Another way would be OSQL.. For example:
You could do it as part of a DTSX package to import.
HTH,
Kent
osql -SINSTANCE\SERVERS -Uuser -Ppassword -n -iyour_sql_file.sql -oresult.log -w250
You could do it as part of a DTSX package to import.
HTH,
Kent
If OSQL blows, try SQLCMD. Use everything kdyer showed you in his code, just substitute sqlcmd for osql.
ASKER
this is exactly what im doing, and its working...although....i dont like the manual work lol. but yes, thank you.
I've been in DBA and SQL work for over 35 years, and I have yet to write a SQL file that has reached 1MB. What are you doing that must make this 50MB?