To view and edit the contents of an Advance Steel database, you first need to attach it in SQL Server Management Studio.
To view and edit the contents of an Advance Steel database, you first need to attach it in SQL Server Management Studio.
To attach an Advance Steel database:
If you make a copy of an Advance Steel database in a different location on the disk and rename it, when you need to attach the copied database it is important you make some adjustments to be sure that the database copy is targeted.
After adding the copied database using the Add command, notice that the original database is still referenced:
This means that if you continue with the attachment process and you make changes in the database afterwards, the changes will be applied to both the original database and the copied database.
In order to make sure that the changes are made only to the copied database and not to the source database too, you need to make the following settings in the Attach Databases window:
The attachment process can be validated and the copied database will be available for editing in SQL Server Management Studio:
Important notes:
To detach a database from SQL Management Studio (remove it from the Databases list), right-click to select the database and select Tasks Detach… from the contextual menu. To finish detaching the database, confirm by clicking OK in the window that pops up.
Detach bulk databases from a LocalDB instance
Every time an application uses a MDF database, the SQL LocalDB will remember that connection in order to optimize future access to it.
In case the number of attached databases in the LocalDB increases, performance might be slower than expected. To improve this, you can manually detach all the attached databases, using the following query:
DECLARE @dbname AS VARCHAR(MAX); DECLARE @server_name AS VARCHAR(MAX); SELECT @server_name = @@servername DECLARE rs_cursor CURSOR FOR SELECT name FROM master.dbo.sysdatabases WHERE name NOT IN ('model', 'master', 'msdb', 'tempdb', 'alert_db', 'mssecurity'); OPEN rs_cursor; FETCH NEXT FROM rs_cursor INTO @dbname; WHILE @@FETCH_STATUS = 0 BEGIN EXEC sp_detach_db @dbname; PRINT 'Detach of "' + upper(@dbname) + '" database successfully completed.'; FETCH NEXT FROM rs_cursor INTO @dbname; END CLOSE rs_cursor; DEALLOCATE rs_cursor; PRINT CHAR(13) + 'All databases successfully detached from: ' + upper(@server_name);