The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
35 views

Unique key constraint violation not escalated to parent stored procedure

I have a stored procedure which calls 2 nested sub procedures. For Example, MyProc BEGIN BEGIN TRY BEGIN TRAN EXEC UpdateProc EXEC InsertProc COMMIT TRAN END TRY ...
4
votes
1answer
767 views

How can I handle unwanted, non-erroneous situations better?

When writing procedures, I occasionally encounter situations in which I want to abort the procedure, even if the situation didn't necessarily trigger an error. Let's say, if I don't want John to be ...
0
votes
0answers
29 views

Exclude a Variable from getting logged in a CheckPoint file

I have an SSIS package in SQL Server 2014 which uses checkpoint to handle the cases where it needs to be run after a failure. There is a variable in the package that I want to be set to 0 whenever the ...
0
votes
1answer
22 views

Catching two error messages/Throw into table

My goal is to catch errors from backup jobs into monitoring table. The problem is, that there are cases that backup statement returns more than one error, so ERROR_MESSAGE() is not enough: Msg ...
0
votes
0answers
24 views

How to return a user defined error code through SQL based on the error

I would like to return a user defined error code in my SQL Server stored procedures based on the outcome. For example, if no error takes place, RETURN 0. If a validation error takes place, return 20....
2
votes
1answer
31 views

Logical condition when declaring handler procedure

I have a procedure in MySQL that executes a handler for SQLEXCEPTION to read the errno code and insert it to a table. DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN GET DIAGNOSTICS CONDITION 1 @...
0
votes
1answer
38 views

Display the error message returned form Mysql

I need to get the whole error message returned from MySQL and assign it to @error_string : DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN SET @error_string = '...
1
vote
2answers
52 views

Is there a way to have multiple error messages displayed with RAISERROR conditionally?

I am thinking of something like the CASE statement for RAISERROR, but I want the remaining code to be checked too, and not skip anything after encountering the first RAISERROR. Right now I have ...
3
votes
1answer
95 views

PostgreSQL UNIQUE constraint error message

On Appendix A: PostgreSQL error codes, it says: For some types of errors, the server reports the name of a database object (a table, table column, data type, or constraint) associated with the ...
0
votes
0answers
32 views

Because of a wrong entry with wrong date, how can we rollback a database synchronized over multiple systems?

On a mobile device, a set of operations has been saved in the local DB with a wrong date (because the system date was set in the future). Then the device regularly doing synchronisation with a server ...
6
votes
2answers
164 views

list of batch aborting errors in SQL server

In SQL Server, if XACT_ABORT is off then some errors will terminate the current statement (for example supplying the incorrect number of parameters to a stored procedure that takes some parameters) ...
6
votes
2answers
609 views

Raise error if BCP command fails to dump data into a file

Using the BCP command I am generating files of SQL Server DB tables. The BCP command creates an empty file for each table when it's unable to dump data into the files. This can be caused by an error ...
0
votes
1answer
16 views

First Insert is skipped by the trigger

I am facing a very strange issue as i have implemented a trigger on tableA which does encrypt data and insert data to another tableB and update column to 4 digit. The issue is First insert is somehow ...
1
vote
2answers
134 views

Error 18456 Serverity 14, State 38

I have an application that logs into SQL Server 2014 that uses a single login to access the database when a user opens up the application. In other words I have 6 users using the same application ...
1
vote
1answer
49 views

Why does everyone want me to create an alert for severity 025?

Brent Ozar and others suggest to listen to severity 025 SQL-Server events. I searched for the meaning of all different high severity events, looked through different articles and read the most recent ...
0
votes
0answers
11 views

MySQL 5.5 exception handlers

Does MySQL 5.5 support handlers for exception handling? If not is there any other way to handle exception? I tried using handlers but it isn't working. Please help
2
votes
1answer
103 views

How to get all messages raised when a statement fails

Executing the below query will generate two error messages ALTER TABLE [MFClassProperty] DROP CONSTRAINT [FK_MFClassProperty_MFProperty] Error messages are: Msg 3728, Level 16, State 1, Line 3 ...
1
vote
3answers
731 views

How to use a MySQL error handler in a stored procedure with prepare/execute

I have a procedure defined like this: drop procedure if exists drop_tables_like; delimiter $$ create procedure drop_tables_like(myint int, pattern varchar(255), db varchar(255) ) begin DECLARE ...
0
votes
1answer
59 views

MySql Insert signal if where clause fails

As part of a chained sequence of transactional queries, I'm inserting values that exist in a temporary table into a new table. Every query is validated for errors in PHP using: if (!mysqli_query($...
0
votes
1answer
92 views

How to prevent #Error values derived from Nulls in an outer join

Suppose I have two tables to outer join Tab1: ID Nam 1 Joe 2 Moe 3 Flo Tab2: ID Val y w 1 stuff 66 33 2 duff 67 44 and one of the resulting columns is derived -- i.e., it'...
4
votes
2answers
3k views

How to get exception context for a manually raised exception in PL/pgSQL?

In Postgres, we get the "stack trace" of exceptions using this code: EXCEPTION WHEN others THEN GET STACKED DIAGNOSTICS v_error_stack = PG_EXCEPTION_CONTEXT; This works fine for "natural" ...
0
votes
1answer
582 views

XACT_ABORT ON not working as expected on SQL Server 2012?

It looks like XACT_ABORT ON is not working as expected. Here are a table and a procedure that inserts into it: CREATE TABLE rain ( rain_time DATETIME , location VARCHAR(100) ); GO ...
2
votes
1answer
622 views

sqlcmd -b doesn't exit on error

I'm confused how should I use -b parameter of sqlcmd. I'm trying to write simple automation script for my DB and wanted to stop execution in case of any errors. I'm using SQLServer 2008r2. For ...
1
vote
1answer
188 views

Is there a way to query all error messages in Postgres?

Postgres has a catalogue of possible error messages here: http://www.postgresql.org/docs/8.2/static/errcodes-appendix.html#ERRCODES-TABLE However, I would like to query this information from a ...
0
votes
1answer
12k views

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I know this might be a duplicate of some other posts. But those solutions didn't work for me and I've lot of issues within those answers. Neither could I comment nor post in there, I'm posting a ...
2
votes
1answer
926 views

How to ignore sql errors in stored procedure ? (Not handle)

I have a list of records I want to process and the cursor iterates through them from a table. The procedure just exits when it hits an insert statement and it fails. Is there a way I can ignore the ...
1
vote
1answer
530 views

Possible to use a Trigger as failsafe for insert in two databases?

(This is for a project on MSSQL 2008R2 Server) I have been tasked with splitting a table into an internal (same db as before) and an external one (different server). Currently the idea is to read ...
2
votes
1answer
480 views

Tracing 'Invalid Number Error' from millions of rows using a large, complicated query

Background I am working on fixing a large query that I inherited. The query consists of over 200 lines of DML statements. The search queries the database restricting the data to a single month. Most ...
0
votes
1answer
2k views

Error 1236 From Master After Restored Replication

I've been trying to restore a broken replication caused by power interruption. upon checking the slaveDB, it was already broken so I setup a new replication. And upon supposedly completing the ...
1
vote
1answer
3k views

Override/kill when Code 3/SQLSTATE=57016 Occurs

I have encountered issues a few times when a process of mine performs a bulk load to a temp table we use for pre-processing purposes. The Bulk load fails for one reason or another (this we are looking ...
8
votes
2answers
19k views

How to break SQL script execution

I am working on sql script and I am having a requirement of stop continuing the script if some conditions are not satisfied. When I Google it, I found the RaisError with 20 severity level will ...
2
votes
1answer
532 views

Moving away from CmdExec steps in job without losing logging detail (SQL Server 2008)

My department currently relies heavily on CmdExec steps in SQL Server Jobs, called using a SQL Server Login. For example osql /e /n /S SERVER01 /U USER /P PA$$$ /d DATABASE_01 /i "\\LOCATION\OF\SQL\...
1
vote
1answer
111 views

Oracle error handling strategy [duplicate]

I am developing a project using oracle. I am writing functions and stored procedures to handle CRUD statements. My question is in addition to oracle check constraints do I have to check error ...
2
votes
3answers
1k views

Backups script completes, but doesn't back up all dbs

I'm running sql server 2005 and I've made a simple backup script that backs up all the databases on one server. The script always succeeds, but when I go to check the log or the files, I see it has ...
1
vote
1answer
487 views

How to suppress an informational raiserror message

I have a setup script that calls sp_configure a few times to set up some system variables, it works fine but I have a few of the following statement Configuration option '%ls' changed from %ld to %...
1
vote
2answers
828 views

Long time, sporadic 'String or Binary data would be truncated.' Wisdom would be appreciated

TL;DR How can I diagnose the source of a very inconsistent, un-reproducable 'String or Binary data would be truncated.' error, when I am quite positive the problem isn't related to user data being to ...
2
votes
1answer
2k views

DB2 Server Table Space Locked

At work we keep receiving the following DataException seemingly at random when one of our processes tries to write/access a table for one of our clients: com.ibm.db.DataException: A database manager ...
4
votes
3answers
6k views

What is ERROR_STATE() in SQL Server and how it can be used?

I read that ERROR_STATE() can help to distinguish between different states/locations in the source code where same type of error can occur. But it is not really clear to me that how it can be useful. ...
6
votes
1answer
994 views

Package state not re-intialized on raise_application_error

When a package has state and the header is changed, the first call gets an error stack something like this: ORA-04068: existing state of packages has been discarded ORA-04061: existing state of ...
4
votes
1answer
6k views

Finding exact statement causing error 3930

Lately I've been seeing errors in the SQL Server Log. Code:3930 Description:"The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the ...
3
votes
1answer
10k views

Postgres requires commit or rollback after exception

Just trying to understand the thinking here... This bug explains that with other databases, you are allowed to run additional commands after a SQLException occurs. It was written in 2001 but has ...
5
votes
1answer
1k views

Raising an error with a system message_id in SQLCLR

If call CREATE DATABASE foo twice I get the error message: Msg 1801, Level 16, State 3, Line 1 Database 'dropme' already exists. Choose a different database name. The error message is listed in sys....
7
votes
1answer
726 views

CATCH block is triggered when it should not

On my neverending quest for shooting myself in the foot with save transaction I seem to have found even more ways to fulfill the quest purpose. The save transaction clause itself this time is out of ...
10
votes
2answers
3k views

Does Oracle PL/SQL have a standard ASSERT routine?

I'd like to use an ASSERT routine functionally similar to the one found in other languages, i.e. a construct (be it a procedure, syntax...) ASSERT( <condition>, <msg>) such that when ...
2
votes
0answers
222 views

CREATE ASSEMBLY - EXCEPTION_ACCESS_VIOLATION

I am trying to create an assembly on my SQL Server 2005 server. Here is what I am using: CREATE ASSEMBLY [SQLCLRTest] AUTHORIZATION [dbo] FROM 'path\to\my\file.dll' WITH PERMISSION_SET = ...
5
votes
3answers
5k views

Write to Error Log

Using SQL Server 2008 R2: How can I write to the SQL Server Error Log? I have a ROLLBACK statement that I'd like to couple with a statement written to the error log for external monitoring. Example:...
6
votes
3answers
11k views

How to log error details when using using try/catch for dynamic SQL backup commands

When issuing a backup command within a stored procedure that uses a try catch and dynamic sql, the error messages are very general when compared to running the backup command directly. Try/Catch ...
0
votes
1answer
2k views

How to create custom error messages in APEX?

I would like to replace standard ORA-xxxxx messages with custom ones in Oracle Application Express. For example instead of this: to have something like "You have left some fields blank, try again". ...
2
votes
1answer
4k views

log_warnings doesn't seem to work for aborted connections in MySQL 5.1

The docs for 5.1 say that I can set log_warnings = 2 to capture Aborted_connects in the error log. This bug report suggests that this was only merged into 5.5 and 6.0 (and maybe 5.2) but not into 5.1....
3
votes
1answer
605 views

tds: unable connect to SQL Server using servername specified in freetds.conf file

I am using freetds to connect to SQL Server from ubuntu. First, the SQL Server is running at port 1433 currently. I can telnet it. The following command also works. I can query table data using it, ...