first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

SQL Server 2000: Flippant Remarks about Renaming Databases

Use the ALTER DATABASE t-SQL instead of the system stored procedure sp_renameDB. For SQL Server 2000, the ALTER DATABASE solution is an improvement over the system stored procedure (which can get into goofy 'exclusive locking errors'). One too many SQL Server MVPs confuse the new SQL 2005 features with the old SQL 2000 limitations. Google sees all and you beta-junkies in the newsgroups are no help!

In old SQL Server 2000, the ALTER DATABASE syntax is only useful for renaming the logical database and not the physical files on disk. The best way to handle the physical files is to grit teeth and create a new database.

Here is a sketch of the ALTER DATABASE syntax:

ALTER DATABASE 'my_old_ass_dbname'
MODIFY NAME 'my_funky_fresh_dbname'
mod date: 2005-04-28T20:05:33.000Z