SQL Server 200(x) useful commands

Now that I use SQL Server all the time, I thought I’d better start recording my "Oh that’s how it’s done, I wish I had that written down somewhere" Commands Moving a database from one machine to another. 1. Create the database on the new machine with the same name 2. Detatch it 3. Run this: use MyDBName

go sp_attach_db ‘MyDBName’,’C:\work\utilico\DB\MyDBName.mdf’,’C:\work\utilico\DB\MyDBName_log.ldf’ go 4. Done