Home > Database > Mysql Tutorial > mssql @@ERROR 使用

mssql @@ERROR 使用

WBOY
Release: 2016-06-07 17:58:27
Original
946 people have browsed it

@@ERROR返回一个整数 0为正常

mssql
错误日志文件存放位置:C:\Program Files\Microsoft SQL Server\MSSQL\LOG 用记事本查看
@@ERROR返回一个整数 0为正常
sysmessages 存放的错误信息系统表(master)
USE master
select * from sysmessages where error=错误编号 可查询错误的原因
触发器中可用 RAISERROR (50009, 16, 10) 抛出错误,其中50009就是错误编号,也可以是错误信息说明 16 10 具体的行和列可自已定
也可定义自定义的消息
将自定义的消息添加到 sysmessages。
USE master
EXEC sp_addmessage 50001, 16,
N'Percentage expects a value between 20 and 100.
Please reexecute with a more appropriate value.','us_english',false,replace
EXEC sp_addmessage 50001, 16, '员工代码没有找到','简体中文',false,replace
50001 16 必须一致 先添加 us_english版的,再添加 '简体中文'
replace 意思是说,如果存在 50001 编号的信息,就会被新的信息替换
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template