USE [master]
GO
CREATE DATABASE [AdventureWorksDW] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorksDW_Data.mdf' ),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorksDW_Log.LDF' )
FOR ATTACH
GO
if exists (select name from master.sys.databases sd where name = N'AdventureWorksDW' and SUSER_SNAME(sd.owner_sid) = SUSER_SNAME() ) EXEC [AdventureWorksDW].dbo.sp_changedbowner @loginame=N'OFFICE1\Vidas', @map=false
GO

0 Comments:

Post a Comment