다음의 단계를 수행하면 되며, 자세한 옵션은 본인이 해결 하면 되겠다.
- 기존 DB의 개체 생성 Script 저장
- Detatch
- 기존 DB의 MDF, LDF파일 이름을 변경해서 Attatch
- 1번에서 생성된 Script 실행
- DTS로 데이타 이동
http://ssw.com.au/SSW/KB/KB.aspx?KBID=Q711843
Question by: Arun Iyer Answered by: David Klein Last Updated: 15/11/2007 12:02:16 PM
Spot an error? Please comment about this article
Question:
How do I change the collation order in my SQL Server 2000 or 7.0 database?
OR
I want to know how to fix the Database Collation differs from Server Collation Rule in SSW SQL Auditor
OR
I am getting the error 'Collation order on the two databases is different. SSW SQL TOTAL COMPARE cannot compare databases with different Collation orders'. I assume I need to change the collation order in my SQL Server database, how do I do that?
Answer: In SQL 7.0, there can be only one Collation per server, so to change the Collation of a Database you need to change the Collation of the server itself. A Database with a Collation that differs from the server cannot be attached to that server. Solutions include setting up another SQL Server with the desired Collation and transferring the Database using DTS or using BCP to export the data before rebuilding the Server with the new Collation.See SQL Server Suggestion - Change the collation
Servers have a default Collation which is inherited by new Databases where a Collation is not specified. Warning: these steps assume that the Database uses a single Collation for all objects specified at the Database level. If you require different Collations for individual columns then do not proceed.
There is no 'recommended' Collation as different Collations will be used in different countries. As a guideline: Once a Collation has been decided on, it should be used for all servers in your organisation. SQL Server Books Online SQL Server Architecture - Changing Collations
Change the Collation of your Database
Using SQL Server 7.0
Using SQL Server 2000 and Above
Unlike SQL 7.0, 2000 does support different collations for each database on the one server. The ALTER DATABASE COLLATE command will only change the *DEFAULT* collation of the database, it will not change collation of existing objects (e.g. columns & tables). They will still be stored in the old collation order even if the default is changed. You'll need to
Databases have a Collation. Either unspecified (which uses the Server default) or a specified Collation.
Columns have a Collation. Either unspecified (which uses the Database Collation) or a specified Collation.
Steps for SQL Server 2000
Right-click on the Database > All Tasks > Generate SQL Script…
Show All > Tick All Objects
GO
SELECT name, filename
FROM sysfiles
GO
USE master
sp_detach_db @dbname='MyDatabase'
rename MyDatabase.mdf to MyDatabaseOLD.mdf
Note: Data files are usually in C:\Program Files\Microsoft SQL Server\MSSQL\Data\
EXEC sp_attach_db
@dbname = N'MyDatabaseOLD',
@filename1 = N'C:\Program Files\Microsoft SQL Server\MSSQL\Data\MyDatabaseOLD.mdf',
@filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\MyDatabaseOLD_log.ldf'
Eg. Find "COLLATE SQL_Latin1_General_CP1_CI_AS"
and replace with nothing (empty string).
This means that the database and columns will use the Collation specified as the server default collation.
-- Therefore we need to turn off the relationship data check temporarily
EXEC sp_msforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
-- and turn off all triggers temporarily
EXEC sp_msforeachtable 'ALTER TABLE ? DISABLE TRIGGER ALL'
Note: Don’t miss the tick on 'Use Collation'
Which Collation to Use?
-- Therefore turn on the relationship data check again
EXEC sp_msforeachtable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
-- Therefore turn on the triggers again
EXEC sp_msforeachtable 'ALTER TABLE ? ENABLE TRIGGER ALL'
More Information
Topic: Data Conversion and Transformation Considerations
Section: Code Pages, Collation, and Non-Unicode Data Issues
Section: Copy SQL Server Objects Task
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/architec/8_ar_da_819v.asp
Keywords: Hot Tip - SQL Server 2000 Hot Tip - SQL Server 2005