Cannot see full error messages in SQL Server

kalvaro posted 6 years ago in Running SQL scripts
Given the following code:

PRIMARY KEY (foo_id)
INSERT INTO foo (foo_id) VALUES (1);

If you run a query that triggers an error, e.g.:

INSERT INTO foo (foo_id) VALUES (1);

... all you see in HeidiSQL is this:

SQL Error (3621): Se terminó la instrucción.

In Microsoft SQL Server Management Studio the error is this:

Mens. 2627, Nivel 14, Estado 1, Línea 1
Infracción de la restricción PRIMARY KEY 'PK__foo__650E807E'. No se puede insertar una clave duplicada en el objeto ''.
Se terminó la instrucción.

HeidiSQL only displays the last line and discards the relevant bit (duplicate PK).
ansgar posted 6 years ago
Can confirm that. There are two sources where to look at for an error message. The first one is TAdoConnection.Errors, which is currently processed. The second one is the EOleException message which for example pops up after firing a faulty query. Sometimes both contain the same text, for example in an attempt to connect with wrong credentials. So, the fix will be to take the exception message into the error dialog only if TAdoConnection.Errors does not already contains that text.

Google Code SVN seems to be offline right now, so it may take some time to commit. See .
ansgar posted 6 years ago
Done, please test r4406.
kalvaro posted 6 years ago
Much better now, thank you!

Being picky... I have the impression that there're some carriage returns that are being stripped out:

ansgar posted 6 years ago
You mean, because Management Studio has a carriage return between those two messages? Well, the two messages are joined together with a space only in HeidiSQL, but I guess it'll be more readable if we use a linefeed.
kalvaro posted 6 years ago
I mean that Error de INSERT (INSERT error) and Se terminó la instrucción (Statement completed) are different sentences but the first one doesn't end with period so it's confusing.
kalvaro posted 6 years ago
Or, just seen Again, thank you!

Please login to leave a reply, or register at first.