If you aren't able to open the .mdf n .ldf files via SSMS and receiving errors
Use the below script in a 'new query' in SSMS to find the sql service account
Code Snippet
declare @sqlser varchar(20)
EXEC master..xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key='SYSTEM\CurrentControlSet\Services\MSSQLSERVER',
@value_name='objectname', @value=@sqlser OUTPUT
PRINT 'Account Starting SQL Server Service:' +convert(varchar(30),@sqlser)
After getting the service account try the below steps to provide privilege
Right click on the .mdf/.ldf saved in your system and click on properties
Click on security tab
Click on Add button and add sql service account
Provide modify privilege and click ok
Verify both mdf and ldf have modify privilege
Attach the database..
then you can easily work on the database tables..
To insert:
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)
To Delete:
DELETE FROM table_name
WHERE some_column=some_value
Notice the WHERE clause in the DELETE syntax. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!
To Update:
UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
Happy SQLing !!! :)