Welcome -
Guest!
Login
/
Register Now
|
Search:
Home
Articles
Forum
Interview FAQ
Activities
News
Videos
Poll
Links
People
Groups
SQL Server Articles
Submit Article
Home
»
Articles
»
SQL Server
»
System Functions
RSS Feeds
@@ERROR - ERROR Function
Posted By:
Sarita Patel
Category:
SQL Server
Views:
1954
This article explains about @@ERROR function in sql server with examples.
@@ERROR function returns error number of last sql statement executed.
It is a nondeterministic i.e It returns different value every time it is called with a specific set of values.
Syntax of @@ERROR Function :
@@ERROR
Return type
of @@ERROR function is an integer. @@ERROR is set to 0 if the statement executed successfully otherwise error number.
Examples of @@ERROR Function :
Example 1 : Use of @@ERROR function after executing select clause
SELECT ProductName, UnitsPrice
FROM Products
IF (@@ERROR > 0)
BEGIN
SELECT error, description FROM master.dbo.sysmessages WHERE error = @@ERROR
END
Output
error description
207 Invalid column name '%.*ls'.
Above example returns error number and description of executed sql statement.
Share:
Previous Post:
DATALENGTH Function
Next Post:
fn_helpcollations Function
Didn't find what you were looking for? Find more on
@@ERROR - ERROR Function
Or get
search suggestion and latest updates
.
Sarita Patel
author of @@ERROR - ERROR Function is from
United States
.
View All Articles
Related Articles and Code:
Collect system diagnostic message to from error log - dmesg
PROGRAM SHOWING ROUND-OFF ERRORS IN FLOATING POINT COMPUTATIONS
Detection of errors in scanf input
ERROR HANDLING IN FILE OPERATIONS
Different types of Error in unix
TCP/IP program to cleanup and exit with an error message
TCP/IP program to print an error message and exit
Error: "Unsupported Context Type" when trying to add new controller.
Example 4 of using function and local variables in functions
Program of nesting member functions, private member functions and array of objects
Shell script for following conditions. Take two files as input and run spell command on it, Collect a list of potential spelling errors, modify file
Program which creates an Array of character. Make one function with one argument as a character and that function throw a user defined exception
Program to read numbers from two files using fscanf function and write it in another file using fprintf function in ascending order
Write a function to perform string operation i.e. split, join, length, substring using pointer without using any string function
How to perform SELECT ALL Data function in Oracle
Display student details born in year 1980 to 1982 using to_char() function
Program to read string using gets() function and display in upper case
User Defined Functions
Function
String functions
Other Interesting Articles in SQL Server:
INDEXKEY_PROPERTY Function
SQL Server Tutorial
ISNULL Function
LOWER Function
GETDATE Function
IDENT_CURRENT Function
CEILING Function
@@ROWCOUNT - ROWCOUNT Function
QUOTENAME Function
COLUMNPROPERTY Function
String Functions
CAST Function
USER_ID Function
STATS_DATE Function
IN Operator
ROUND Function
Where clause with select query
COL_NAME Function
SPACE Function
SOUNDEX Function
Please enter your Comment
*
*
Comment should be atleast 30 Characters.
Please put code inside [Code] your code [/Code].
Please login to post comment
No Comment Found, Be the First to post comment!
SQL Server
View All
Aggregate Functions
Analytical Functions
Configuration Function...
Constraints
Cursor
Cursor Functions
Data Control Language
Data Definition Lang
Data Manipulation Lang
Data Type
Database
Date Time Functions
Functions
Index
Interview FAQ
Joins
Math Functions
Meta Data Functions
Miscellaneous
Operator
Rowset Functions
Security Functions
Select Query
Sequence
Stored Procedures
String Functions
Sub Query
System Functions
System Statistical Fun...
Text and Image Functio...
Transaction Control La...
Trigger
View
Assembly Language
Artificial Intelligence
C Programming
C++ Programming
Visual C++
OOAD
Cobol
Java
Asp.net MVC
Rest and WCF Services
Entity Framework
Knockout.Js
Unix / Linux / Ubuntu
Networking
OOPs Concept
HTML
Dos
SQL
System Analysis & Design
Gadgets
Internet
CSS
Javascript
.Net Framework
Asp.net
C#
VB.Net
Python
Perl
Oracle
Software Engineering
RDBMS Terms
AJAX Framework
Design Pattern
UML
WPF
WCF
SEO
PowerShell
Visual Studio
WWF
BizTalk Server
Azure
General
Testing
Online Certifications
PHP
My SQL
LinQ
Project Management
Silverlight
XML
MS Office
Windows OS
DHTML
Sharepoint