Cannot see full error messages in SQL Server

kalvaro's profile image kalvaro posted 11 years ago in Running SQL scripts Permalink
Given the following code:

CREATE TABLE foo (
foo_id INT NOT NULL
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 'dbo.foo'.
Se terminó la instrucción.


HeidiSQL only displays the last line and discards the relevant bit (duplicate PK).
ansgar's profile image ansgar posted 11 years ago Permalink
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 https://code.google.com/p/support/issues/detail?id=30749 .
Code modification/commit from ansgar.becker, 11 years ago, revision 8.0.0.4406
Use additional EOleException message in GetLastError. See http://www.heidisql.com/forum.php?t=12758
ansgar's profile image ansgar posted 11 years ago Permalink
Done, please test r4406.
kalvaro's profile image kalvaro posted 11 years ago Permalink
Much better now, thank you!

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

ansgar's profile image ansgar posted 11 years ago Permalink
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.
Code modification/commit from ansgar.becker, 11 years ago, revision 8.0.0.4408
Join the two error message snippets with a linefeed, not a space, so that gets more readable. See http://www.heidisql.com/forum.php?t=12758
kalvaro's profile image kalvaro posted 11 years ago Permalink
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's profile image kalvaro posted 11 years ago Permalink
Or, just seen http://code.google.com/p/heidisql/source/detail?r=4408. Again, thank you!

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