-- Step1: put the database offline
ALTER DATABASE [Database_Name] SET OFFLINE;
GO
-- Step2: move the file to the new location
ALTER DATABASE [Dataabase_Name] MODIFY FILE (NAME = [Logical_File_Name], FILENAME = 'New File Path')
GO
-- Physically move the file to new location
-- Step3: bring the database online
ALTER DATABASE [Database_Name] SET ONLINE
GO
This blog is mostly a blog for me with hints to remember those little bits of code etc where ever I am. Please be aware of this when reading any of the posts as they are mainly reminders for me. When I get time I will try to flesh out those sections that are a little ambiguous.
Saturday, 26 February 2011
Wednesday, 23 February 2011
Check your Databases are set to Trustworthy
SELECT dtb.[name] AS [database],
CASE(dtb.is_trustworthy_on)
WHEN 0 THEN 'False'
WHEN 1 THEN 'True'
END AS [Trustworthy]
FROM master.sys.databases AS dtb;
To change database to Trustworthy:
ALTER DATABASE DatabaseName SET TRUSTWORTHY ON
GO
CASE(dtb.is_trustworthy_on)
WHEN 0 THEN 'False'
WHEN 1 THEN 'True'
END AS [Trustworthy]
FROM master.sys.databases AS dtb;
To change database to Trustworthy:
ALTER DATABASE DatabaseName SET TRUSTWORTHY ON
GO
Tuesday, 15 February 2011
Finding SQL Collation with SQL Transact
SELECT DATABASEPROPERTYEX('<DB_NAME>', 'Collation') SQLCollation
Subscribe to:
Posts (Atom)