As we all know, 2012 the biggest new features of SQL Server is "Allways ON", in fact, in addition to this, on some internal functions and DMV also made a big improvement, where most of the lists, hoping for some friends to be upgraded help.
Feature changes
function name |
Original function |
Solution |
BACKUP DATABASE 或 LOG WITH PASSWORD |
RESTORE {DATABASE | LOG} WITH [ MEDIA] PASSWORD continue not recommended. |
no |
Backup and Restore |
RESTORE { DATABASE | LOG } … WITH DBO_ONLY |
RESTORE { DATABASE | LOG } … … WITH RESTRICTED_USER |
Configuration Options |
sp_configure 'user instance timeout' 与'user instances enabled' |
Use a local database functionality |
Database Options |
sp_dboption |
ALTER DATABASE |
Metadata |
DATABASEPROPERTY |
DATABASEPROPERTYEX |
Query hint |
FASTFIRSTROW Tips |
OPTION (FAST n) |
safety |
sp_dropalias |
Please alias replaced by a combination of user accounts and database roles. Please use the upgraded sp_dropalias delete the alias database. |
SET Options |
SET DISABLE_DEF_CNST_CHK |
no |
System Tables |
sys.database_principal_aliases |
Use roles instead of aliases |
Transact-SQL |
Format RAISERROR integer 'string' is no longer used RAISERROR |
Please use the current RAISERROR (...) syntax to rewrite the statement |
Transact-SQL syntax |
COMPUTE / COMPUTE BY |
Using ROLLUP |
Transact-SQL syntax |
* = * = And usage |
Using ANSI join syntax |
XEvents |
databases_data_file_size_changed、databases_log_file_size_changed |
替换为 database_file_size_change event、database_file_size_change |
Select from named NEXT column or table |
Sequence using ANSI standard NEXT VALUE FOR function. If the table or column and the named NEXT alias tables or columns of VALUE, in the case of ANSI standard AS is omitted, the resulting statement may result in an error. |
To resolve this problem, include the ANSI standard AS keyword. For example, SELECT NEXT VALUE FROM Table should be rewritten as SELECT NEXT AS VALUE FROM Table, SELECT Col1 FROM NEXT VALUE should be rewritten as SELECT Col1 FROM NEXT AS VALUE. |
PIVOT operator |
When the database compatibility level 110, the operator is not allowed PIVOT recursive common table expressions (CTE) query. |
Rewrite the query, or the compatibility level to 100 or less. When each group has multiple rows, use PIVOT in a recursive CTE query will produce incorrect results. |
sp_setapprole 和 sp_unsetapprole |
sp_setapprole the cookie OUTPUT parameter currently referred to as varbinary (8000), which is the correct maximum length. However, the current implementation returns varbinary (50). Applications should remain varbinary (8000), so that when the cookie return size of the increment in future releases, the application can continue to run correctly. For more information, see sp_setapprole (Transact-SQL). |
|
sys.fn_get_audit_file function |
Adds two new columns (user_defined_event_id and user_defined_information) to support user-defined audit events |
|
WITHIN reserved keyword |
WITHIN is now a reserved keyword. Reference object called "within" or columns will fail. |
Renaming objects or columns, or to separate names by using parentheses or quotation marks. For example, SELECT * FROM [within]. |
CONVERT and CAST type of computing time or column operation datetime2 |
在 SQL Server 的早期版本中,对 time 或 datetime2 数据类型的 CAST 和 CONVERT 操作的默认样式为 121,当在计算列表达式中使用这些类型时除外。 对于计算列,默认样式为 0。 当创建用于涉及自动参数化的查询中或约束定义中的计算列时,此行为会影响计算列。 |
兼容级别为 110 时,对 time 和 datetime2 数据类型的 CAST 和 CONVERT 操作的默认样式始终为 121。 如果您的查询依赖旧行为,请使用低于 110 的兼容级别或在受影响的查询中显式指定 0 样式。 |
ALTER TABLE |
ALTER TABLE 语句只允许两部分的表名 (schema.object)。 使用以下格式指定表名时,现在在编译时会失败,出现错误 117。 |
要解决此问题,请不要使用 4 部分的前缀。 |
浏览元数据 |
使用 FOR BROWSE 或 SET NO_BROWSETABLE ON 查询视图时,现在会返回视图的元数据而非基础对象的元数据。 此行为现在匹配浏览元数据的其他方法。 |
无 |
SOUNDEX |
数据库兼容级别为 110 时,SOUNDEX 函数实现的新规则可能导致由该函数计算的值不同于更低数据库兼容级别下计算的值。 |
在升级到兼容级别 110 后,可能需要重新生成使用 SOUNDEX 函数的索引、堆或 CHECK 约束。 |
失败的 DML 语句的行计数消息 |
在 SQL Server 的早期版本中,当 TRY-CATCH 块包含失败的 DML 语句并且该语句由数据库引擎自动参数化或 TRY-CATCH 块所处的级别不同于失败语句的级别时,会向客户端发送不正确的值 -1。 例如,如果 TRY-CATCH 块调用存储过程且该过程中的 DML 语句失败,客户端将错误地收到 -1 值。 |
在 SQL Server 2012 中,DML 语句失败时,数据库引擎将以一致方式将包含 RowCount: 0 的 TDS DONE 令牌发送到客户端 |
SERVERPROPERTY (‘Edition’) |
所安装的 SQL Server 2012 实例的产品版本。 使用该属性的值确定已安装的产品支持的功能和限制(如最大 CPU 数)。 |
|
CREATE LOGIN |
CREATE LOGIN WITH PASSWORD = 'password' HASHED 选项不能用于 SQL Server 7 或更早版本创建的哈希。 |
无 |
视图修改
视图名 |
原列名或类型 |
修改后列名或类型 |
sys.dm_exec_requests |
nvarchar(16) |
nvarchar(32) |
sys.dm_os_memory_cache_counters |
single_pages_kb |
pages_kb |
sys.dm_os_memory_cache_counters |
multi_pages_kb |
pages_in_use_kb |
sys.dm_os_memory_cache_entries |
pages_allocated_count |
pages_kb |
sys.dm_os_memory_clerks |
列 multi_pages_kb 已删除 |
|
sys.dm_os_memory_clerks |
single_pages_kb |
pages_kb |
sys.dm_os_memory_nodes |
pages_allocated_count |
pages_in_bytes |
sys.dm_os_memory_nodes |
max_pages_allocated_count |
max_pages_in_bytes |
sys.dm_os_sys_info |
physical_memory_in_bytes |
physical_memory_kb |
sys.dm_os_sys_info |
bpool_commit_target |
committed_target_kb |
sys.dm_os_sys_info |
bpool_visible |
visible_target_kb |
sys.dm_os_sys_info |
virtual_memory_in_bytes |
virtual_memory_kb |
sys.dm_os_sys_info |
bpool_commited |
committed_kb |
sys.dm_os_workers |
区域设置列已删除。 |
|
sys.data_spaces |
已将新列 is_system 添加到 sys.data_spaces 和 sys.partition_functions。 (sys.partition_schemes 和 sys.filegroups 将继承 sys.data_spaces 的列。) |
转载于:https://www.cnblogs.com/iamasqldba/p/3201985.html