ALTER DATABASE oldDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE ALTER DATABASE oldDBname MODIFY NAME =newDBname ALTER DATABASE newDBname SET MULTI_USER
Mother Teresa’s Anyway Poem People are often unreasonable, illogical and self centered; Forgive them anyway. If you are kind, people may accuse you of selfish, ulterior motives; Be kind anyway. If you are successful, you will win some false friends and some true enemies; Succeed…
IF EXISTS (SELECT name FROM sys.databases WHERE name = N’dbname’) DROP DATABASE [dbname] GO
this happened because I had an instance of SS 2008 installed on my machine and then I installed visual studio express with ss express. I needed to set the properties of the instance to allow both windows and sql server authentication.
begin transaction update v set v.domainacct = a.login from [otherdbname].dbo.ADUserList a inner join dbo.Vacation2011 v on (v.lastname = a.lastname COLLATE SQL_Latin1_General_CP1_CI_AS and v.firstname = a.firstname COLLATE SQL_Latin1_General_CP1_CI_AS) commit transaction
select v.domainacct, a.login, a.firstname afirst, v.firstname vfirst, a.lastname alast, v.lastname vlast –into ##temp from dbo.Vacation2011 v left outer join dbo.ADUserList a on (v.lastname = a.lastname COLLATE SQL_Latin1_General_CP1_CI_AS and v.firstname = a.firstname COLLATE SQL_Latin1_General_CP1_CI_AS)