Addition of SQL Server Database

I accidentally deleted the database today, and I really feel like I'm incapable! Fortunately, the database has a backup, so I restored the data. At first, I thought about re-attaching one. Later, an error was reported. If it could not be solved, the strategy was changed. The process of restoring in database language is as follows:

1. New database query

2. Enter the relevant code in the window

usemaster

go

createdatabase charge

  on (filename='E:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\charge.MDF'),

  (filename='E:\Program Files\Microsoft SQLServer\MSSQL13.MSSQLSERVER\MSSQL\DATA\charge.ldf')

  for attach ;

  go

3. Select the code to execute

After the execution ends, the database is added successfully.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325991141&siteId=291194637