Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Trouble renaming database

Author  Topic 

blodzoom
Starting Member

28 Posts

Posted - 2014-11-04 : 14:16:07
Can somebody please point out my flaw here? I'm trying to use this in an Execute TSql statement task in ssis package.


USE master;
GO
if db_id('MydbBAK') is not null
drop database MydbBAK
GO
if db_id('BIOSUSERS_MYBI') is not null
ALTER DATABASE Mydb
Modify Name = MydbBAK;
GO
CREATE DATABASE Mydb





Cannot create file 'C:\Program Files\PATH\PATH\mydb.mdf' because it already exists. Change the file path or the file name, and retry the operation.

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2014-11-04 : 16:10:59
http://www.mssqltips.com/sqlservertip/1122/how-to-rename-a-sql-server-database/

check the option 3

Javeed Ahmed
https://www.linkedin.com/pub/javeed-ahmed/25/5b/95
Go to Top of Page
   

- Advertisement -