Rename SQL Server 2005 Database and Datafile

Some of this SQL Commands don’t work in SQL Server 2000.


use master;

ALTER DATABASE Cheque_Req MODIFY FILE (NAME =Cheque_Req_Data, FILENAME = 'C:\ABC.MDF')
ALTER DATABASE Cheque_Req MODIFY FILE (NAME =Cheque_Req_Log, FILENAME = 'C:\ABC.LDF')


ALTER DATABASE Cheque_Req MODIFY FILE (NAME =Cheque_Req_Data, NEWNAME = 'cib')
ALTER DATABASE Cheque_Req MODIFY FILE (NAME =Cheque_Req_Log, NEWNAME = 'cib_log')

alter database Cheque_Req set offline;
-- copy existing data and log file and placed in new desired location
alter database Cheque_Req set online;

ALTER DATABASE Cheque_Req Modify Name = cibDB; 

Thanks
A Rahim Khan

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: