Following my previous post, here is the same script for SQL Server Express 2008: USE master GO — the original database (use ‘SET @DB = NULL’ to disable backup) DECLARE @DB varchar(200) SET @DB = ‘MyDB’ — the backup filename DECLARE @BackupFile varchar(2000) SET @BackupFile = ‘c:\temp\mydb.dat’ — the new database name DECLARE @TestDB varchar(200) […]
How to synchronize users after a database restore
After restoring a database on a different server than the one it is coming from, it will contain orphaned users. Here is how to find these orphaned users: exec sp_change_users_login ‘report’ In order to fix this, the logins for the reported users will have to be created on the new server if they do not […]
Changing collation
Once, I was in a situation where I had to change the collation of a database. This is not an easy task, since collations are defined at three levels: Database, Table and Columns. So even, if you change the database collation, all the table and fields will still retain the original collation. Changing collation in […]