How can I detach and attach the SQL database by SP. please help because I want to change the location of my database.
to detach the SQLdatabase, use the following code:
sp_detach_db [ @dbname= ] 'database_name'
[ , [ @skipchecks= ] 'skipchecks' ]
[ , [ @keepfulltextindexfile = ] 'KeepFulltextIndexFile' ]
to attach the SQL database, use the following code:
sp_attach_db [ @dbname= ] 'dbname'
, [ @filename1= ] 'filename_n' [ ,...16 ]
All the best!!
Thanks a lot Dazy for your kind help. Can you please tell me the way to attach the database using SQL Server Management Studio?
I think, there is a corruption in my database so please suggest any utility to repair it. I am not so much aware of SQL server.
Thanks in advance.
First of all, please take the latest backup of your database.
To attach the files using SSMS, follow these steps:
I can suggest one tool which is paid but, I did not use it, so read all the information carefully to purchase it. I am sharing the link with you