distal-attribute
distal-attribute
distal-attribute
distal-attribute

Cannot see full error messages in SQL Server

kalvaro posted 1 year ago in Running SQL scripts
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 posted 1 year 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 https://code.google.com/p/support/issues/detail?id=30749 .
ansgar posted 1 year ago
Done, please test r4406.
kalvaro posted 1 year 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 1 year 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 1 year 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 1 year ago
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.