sql-server – 使用RAISERROR在SQL Server 2005中不起作用?
栏目: 数据库 · SQL Server · 发布时间: 5年前
内容简介:翻译自:https://stackoverflow.com/questions/3414825/using-raiserror-isnt-working-in-sql-server-2005
我有以下代码:
BEGIN TRY BEGIN TRANSACTION -- DO SOMETHIING COMMIT TRAN END TRY BEGIN CATCH IF(@@TRANCOUNT > 0) ROLLBACK TRANSACTION RAISERROR(ERROR_MESSAGE(), ERROR_SEVERITY(), ERROR_STATE()) --ERROR: Incorrect syntax near 'ERROR_MESSAGE'. END CATCH
但是,RAISERROR语句不起作用.提出错误声明有什么问题?
/* Demo Code - Functions accept functions as parameters while stored procedures do not */ create function dbo.fnDayOfWeek (@date datetime) returns int as begin declare @x int set @x = DATEPART(day,@date) return (@x) end go /* Both statements are successful */ select dbo.fnDayOfWeek('2010-08-06') go select dbo.fnDayOfWeek(GETDATE()) go drop function dbo.fnDayOfWeek go create procedure DayOfWeek @date datetime as begin select DATEPART(day,@date) end go /* First call succeeds, second fails */ exec DayOfWeek @date = '2010-08-06' go exec DayOfWeek @date = getdate() go drop procedure DayOfWeek go
翻译自:https://stackoverflow.com/questions/3414825/using-raiserror-isnt-working-in-sql-server-2005
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- SSM框架原理,作用及使用方法
- ssm项目session使用及其作用域问题
- 如何使用纯函数式 JavaScript 处理脏副作用
- antd-design Form,Select联合使用 placeholder 不起作用问题
- ios – 我正在使用XCode 7和Swift,我的控制拖动动作不起作用
- 图解词法作用域与作用域链
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Data Structures and Algorithms in Python
Michael T. Goodrich、Roberto Tamassia、Michael H. Goldwasser / John Wiley & Sons / 2013-7-5 / GBP 121.23
Based on the authors' market leading data structures books in Java and C++, this book offers a comprehensive, definitive introduction to data structures in Python by authoritative authors. Data Struct......一起来看看 《Data Structures and Algorithms in Python》 这本书的介绍吧!
html转js在线工具
html转js在线工具
HSV CMYK 转换工具
HSV CMYK互换工具