The database isn't structured in a way that lends itself to direct modification or interaction therefore the general recommendation is to use the EPiServer API for any interaction with the database.
You can find SDK documentation here http://sdk.episerver.com/
I'll have to object to that :) The EPi-database is fairly well-structured, normalized, pretty easy to read and understand. Also, there are tons of SPs that can be used. If you want to know what SPs are called when from the GUI, run Reflector on the corresponding page.
Of course, the API should be used as much as possible but there are certain tasks that is much more cumbersome to program (if not impossible - due to timeouts) through the API, such as bulk operations, lowercase all URLs, empty recycle bin with 10k pages, bulk-switch types on a large number of properties etc.
Thanks for the input Johan. I agree that database is reasonably well structured and that direct DB interaction is the only way for some things. However I since Guy said he was new to EPiServer I guessed he might want to insert or query "News" pages for example. This obviously isn't best achieved directly through the database. Another example is xforms data (specially since Guy is using EPiServer CMS 5) which are serialised in the database and can only be accessed through the API (without a lot of faffing anyway).
Also EPiServer's official line is always to stay away from the database as much as possible, so was just passing on best practice advice :)
And not to forget: With the APIs you get caching, cache dependencies and purges and cache synchronization between servers.
Typically, if we need to mess with the DB, we run the scripts in conjunction with a release of the site (MSI), after which the site normally restarts anyway (and cache is updated). But sure, during development and testing of scripts, there are quite many iisresets ;-)
New Year, New Job. I'm from a .Net/SQL Server development background, but have taken on a Web Content Manager's role at my new company. To what extent is it possible to interract directly with the underlying SQL Server database that sits behind EPiServer (we're using CMS 5). Are there any good web pages/documentation? I appreciate this is vague, and at this point I'm trying to get an overview.