How to Set Compatibility Level for SQL Server 2008 or 2005 Database Làm thế nào để tương thích Đặt Cấp bậc cho SQL Server 2008 hay 2005 Cơ sở dữ liệu
When selecting data or performing query on Microosft SQL Server 2008 or SQL Server 2005 database, the following error message or failure may be returned: Khi chọn dữ liệu hoặc thực hiện các yêu cầu tìm kiếm trên Microosft SQL Server 2008 hoặc cơ sở dữ liệu SQL Server 2005, sau thông báo lỗi hay thất bại có thể được trả lại:
[Microsoft][ODBC SQL Server Driver][SQL Server][Msg 4147, Level 15, State 1, Line 4] The query uses non-ANSI outer join operators (”*=” or “=*”). [Microsoft] [ODBC SQL Server Driver] [SQL Server] [msg 4147, Cấp bậc 15, Nhà nước 1, Đường 4] Việc sử dụng các truy vấn không ANSI bên ngoài tham gia vận hành ("*=" hoặc "=*"). To run this query without modification, please set the compatibility level for current database to 80, using the SET COMPATIBILITY_LEVEL option of ALTER DATABASE. Để chạy truy vấn này mà không cần sửa đổi, xin vui lòng thiết lập các cấp độ tương thích cho hiện tại cơ sở dữ liệu đến 80, bằng cách sử dụng SET COMPATIBILITY_LEVEL tùy chọn thay đổi cơ sở dữ liệu. It is strongly recommended to rewrite the query using ANSI outer join operators (LEFT OUTER JOIN, RIGHT OUTER JOIN). Đó là khuyến khích mạnh mẽ để ghi đè ANSI yêu cầu tìm kiếm bằng cách sử dụng bên ngoài tham gia vận hành (còn lại Outer công, quyền công Outer). In the future versions Trong tương lai các phiên bản
of SQL Server, non-ANSI join operators will not be supported even in backward-compatibility modes. của SQL Server, không tham gia vận hành ANSI sẽ không được hỗ trợ, ngay cả trong tương-quay trở lại chế độ.
or, hoặc,
Msg 4147, Level 15, State 1, Line 3 Msg 4147, Cấp bậc 15, Nhà nước 1, Line 3
The query uses non-ANSI outer join operators (”*=” or “=*”). Việc sử dụng các truy vấn không ANSI bên ngoài tham gia vận hành ("*=" hoặc "=*"). To run this query without modification, please set the compatibility level for current database to 80 or lower, using stored procedure sp_dbcmptlevel. Để chạy truy vấn này mà không cần sửa đổi, xin vui lòng thiết lập các cấp độ tương thích cho hiện tại cơ sở dữ liệu đến 80 hoặc thấp hơn, bằng cách sử dụng thủ tục lưu trữ sp_dbcmptlevel. It is strongly recommended to rewrite the query using ANSI outer join operators (LEFT OUTER JOIN, RIGHT OUTER JOIN). Đó là khuyến khích mạnh mẽ để ghi đè ANSI yêu cầu tìm kiếm bằng cách sử dụng bên ngoài tham gia vận hành (còn lại Outer công, quyền công Outer). In the future versions of SQL Server, non-ANSI join operators will not be supported even in backward-compatibility modes. Trong tương lai phiên bản của SQL Server, không tham gia vận hành ANSI sẽ không được hỗ trợ, ngay cả trong tương-quay trở lại chế độ.
The error happens because Microsoft has dropped support for and eliminated old-style *= and =* outer join operators. Lỗi xảy ra vì Microsoft đã bỏ hỗ trợ và loại bỏ cũ theo phong cách *= =* bên ngoài và tham gia vận hành.
In order to fix the SQL Server error above, DB administrator has to set the database compatibility level to 80, which equivalent with SQL Server 2000 as a temporary workaround. Để khắc phục lỗi SQL Server ở trên, DB quản trị viên đã thiết lập cơ sở dữ liệu tương thích với cấp độ 80, trong đó tương đương với SQL Server 2000 như là một workaround tạm thời. Of course, the best solution is to modify the SQL statements or queries code to remove the old-style join operators with current standard SQL join syntax. Tất nhiên, một giải pháp tốt nhất là sửa đổi các truy vấn SQL kê hoặc mã số để loại bỏ cũ theo phong cách tham gia vận hành hiện nay với tiêu chuẩn tham gia vao cú pháp SQL.
For example, SQL query below is not valid: Ví dụ, truy vấn SQL dưới đây là không hợp lệ:
SELECT o.name FROM sys.objects o, sys.views v WHERE o.object_id *= v.object_id;
And should be replaced with the following code: Và cần được thay thế bằng các mã sau đây:
SELECT o.name FROM sys.objects o LEFT JOIN sys.views v ON o.object_id = v.object_id;
Or the following abbreviated inner join statement: Hoặc sau đây viết tắt bên trong tham gia tuyên bố:
SELECT o.name FROM sys.objects o, sys.views v WHERE o.object_id = v.object_id;
For administrator who can't change the code, the easiest workaround is to revert the compatibility level of the database in order to provide the backward compatibility to old-style joins. Đối với những người quản trị không thể thay đổi mã số, các workaround là dễ nhất để trở lại các cấp độ tương thích của các cơ sở dữ liệu để cung cấp các tính tương thích để quay trở lại tuổi theo phong cách gia. sp_dbcmptlevel stored procedures (deprecated) or Transact-SQL can be used to set certain (partially, not all) database behaviors to be compatible with the earlier version of SQL Server. sp_dbcmptlevel lưu trữ các thủ tục (deprecated) hoặc giao dịch-SQL có thể được sử dụng để thiết lập một số (một phần, không phải tất cả) sẽ được cơ sở dữ liệu các hành vi tương thích với các phiên bản trước của SQL Server. This Cái này MSDN article MSDN bài viết provides overview on what behaviors are changed on each compatibility level. cung cấp tổng quan về những gì đang có hành vi thay đổi về tính tương thích của từng cấp độ.
Version of SQL Server that can be reverted to can be one of the following: Phiên bản của SQL Server có thể được hoàn nguyên để có thể là một trong những điều sau đây:
60 = SQL Server 6.0 60 = SQL Server 6,0
65 = SQL Server 6.5 65 = 6,5 SQL Server
70 = SQL Server 7.0 70 = SQL Server 7,0
80 = SQL Server 2000 80 = SQL Server 2000
90 = SQL Server 2005 90 = SQL Server 2005
100 = SQL Server 2008 100 = SQL Server 2008
Note: Compatibility level 60, 65, and 70 no longer available in SQL Server 2008. Lưu ý: Khả năng tương thích cấp độ 60, 65, và 70 không còn có sẵn trong SQL Server 2008. And future version of SQL Server will support only two (2) prior version of backward compatibility. Và trong tương lai phiên bản của SQL Server sẽ hỗ trợ chỉ có hai (2) trước khi quay trở lại phiên bản tương thích. A database containing an indexed view cannot be changed to a compatibility level lower than 80. Một cơ sở dữ liệu có chứa một lần xem có thể lập chỉ mục không được thay đổi tương thích với một cấp độ thấp hơn 80. Do also take note that when a database is set to backward-compatibility mode, some of the new functionalities may be lost, such as SQL CLR support and SSMS diagrams for the database. Làm mất cũng lưu ý rằng khi một cơ sở dữ liệu được đặt-để quay trở lại chế độ tương thích, một số các Functionalities mới có thể bị mất đi, chẳng hạn như SQL CLR hỗ trợ và sơ đồ SSMS cho cơ sở dữ liệu. Beside, the compatibility mode affects behaviors only for the specified database, not for the entire server. Bên cạnh, các chế độ tương thích ảnh hưởng đến hành vi chỉ để xác định các cơ sở dữ liệu, không phải cho toàn bộ máy chủ.
Steps to Change and Set Compatibility Level of A Database in SQL Server Bước sau để thay đổi và tương thích Đặt Cấp bậc của một trong cơ sở dữ liệu SQL Server
The following SQL commands can be issued in SQL Server Management Studio Query window. Dưới đây là những lệnh SQL có thể được phát hành trong SQL Server Studio Truy vấn quản lý cửa sổ. Remember to execute Go after each command. Lưu thông tin để thực hiện Về sau mỗi lệnh.
- Optional: Set the database to single user access mode: Tùy chọn: Thiết lập cơ sở dữ liệu duy nhất để chế độ truy cập của người dùng:
ALTER DATABASE database_name SET SINGLE_USER; - Set the database compatibility level to one of the earlier version stated above: Thiết lập cơ sở dữ liệu cấp độ tương thích với một trong những phiên bản trước đó đã nêu ở trên:
Transact-SQL Method Phương thức giao dịch-SQL
ALTER DATABASE database_name SET COMPATIBILITY_LEVEL = { 80 | 90 | 100 }For example, Ví dụ,
ALTER DATABASE my_db SET COMPATIBILITY_LEVEL = 80 Cơ sở dữ liệu thay đổi my_db SET COMPATIBILITY_LEVEL = 80
sp_dbcmptlevel Stored Procedure Method Lưu trữ sp_dbcmptlevel Thủ tục Phương pháp
EXEC sp_dbcmptlevel database_name, compatibility_level value;For example, Ví dụ,
EXEC sp_dbcmptlevel my_db, 90; Exec sp_dbcmptlevel my_db, 90;
- Optional: Put back the database in multiuser access mode: Tùy chọn: Đặt lại cơ sở dữ liệu trong chế độ multiuser truy cập:
ALTER DATABASE database_name SET MULTI_USER;
IMPORTANT : The page is machine translated and provided "as is" without warranty. Lưu ý: Các trang web là máy tính dịch và cung cấp "như là" mà không có bảo hành. Machine translation may be difficult to understand. Máy dịch thuật có thể là khó hiểu. Please refer to Xin vui lòng tham khảo original English article Tiếng Anh bản gốc bài viết whenever possible. bất cứ khi nào có thể.
Related Articles Bài viết liên quan
- Uninstall and Remove Multiple Database Instances of Microsoft SQL Server 2005 Gỡ bỏ và Hủy bỏ Nhiều trường hợp cơ sở dữ liệu của Microsoft SQL Server 2005
- Microsoft DreamSpack Offers Free Download and License of Visual Studio 2008, Server 2003, SQL Server 2005 and More Các chương trình của Microsoft DreamSpack Miễn phí Tải về và Giấy phép của Visual Studio 2008, Server 2003, SQL Server 2005 và Xem thêm
- Optimize SQL Server 2000, 2005 or 2008 in Large RAM System by Locking Pages in Memory and AWE Tối ưu hóa SQL Server 2000, 2005 hay 2008 trong bộ nhớ RAM lớn của hệ thống khóa trang trong bộ nhớ và AWE
- Download Update for Windows 7 and Server 2008 R2 Beta (KB967062) to Fix Common Application Compatibility Issue Tải về Cập nhật cho Windows 7, và Server 2008 R2 Beta (KB967062) để Sửa Những Vấn đề tương thích ứng dụng
- Error Has Occurred While Establishing A Connection To SQL Server 2005 Which Does Not Allow Local and Remote Connections Trong khi lỗi đã xảy ra việc thành lập một kết nối đến SQL Server 2005 nào không cho phép địa phương và các kết nối từ xa
- Microsoft Virtual Server 2005 R2 Download Available for Free Microsoft Virtual Server 2005 R2 Tiên Tải về miễn phí
- Check System Compatibility Via Microsoft New Application Compatibility Toolkit Version 5.5 Qua kiểm tra hệ thống tương thích của ứng dụng mới của Microsoft phiên bản tương thích Toolkit 5,5
- Microsoft Virtual Server 2005 R2 SP1 (Enterprise Edition) Direct Download Links Microsoft Virtual Server 2005 R2 SP1 (Enterprise Edition) Tải về trực tiếp Liên kết
- Internet Explorer (IE) Hang When Opening Virtual Server 2005 Web Administration Site Internet Explorer (IE) Hàng Khi mở Virtual Server 2005 Web Quản trị trang web
- Change Oracle Database User Password Cơ sở dữ liệu Oracle thay đổi người dùng Mật khẩu









































