SQL Transaction Logs filling up

I'm running a query that inserts about 500,000 rows into a table.  The query fails with this error:
Msg 9002, Level 17, State 4, Line 1
The transaction log for database 'database' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases

This happens even if I run dbcc shrinkfile right before I run this query.  I've tried this in both Simple recovery mode and Full recovery mode, with the same result.

From what I can tell, the transaction log isn't truncating because it is filling up in the middle of one active transaction.  What do I do in this instance?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
Make sure you have a big transaction log file.
Shrinking the file is contra productive.

Make sure that if you are in full recovery mode you run regular transaction log backup

Make sure that any ON INSERT trigger on the table is tuned or eventually disabled

Make sure your instance allows you big db files.

Test if you could do the insert in bulk logged mode

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MSECAuthor Commented:
Thanks!  Growing the file beforehand worked.  It seems strange to me, since it was set to unrestricted growth in the first place, but the query ran successfully anyway.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
growing the db file is part of the transaction, but if that takes too long (because of too much IO at once), the growing will "fail", and hence so your transaction.
the error message is misleading, because indeed the file is (still) too small, but actually the growing failed.
however, if you look(ed) at your sql server errorlog, you should find an entry saying that file growth was failing, taking too much time.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.