MS SQL issues
After using 0xDBE for a while there are a few things I have noticed with MSSQL - these may or may not be known issues, I don't have time to check right now.
RAISERROR (@Msg, 0, 1) WITH NOWAIT
...does not print immediately, but only when execution of the full script block ends.
Scripts that should be executed as a whole, such as Ola Hallengren's maintenance script, or Adam Machanic's WhoIsActive:
https://ola.hallengren.com/scripts/MaintenanceSolution.sql
http://sqlblog.com/files/folders/beta/entry42453.aspx
...throw errors when executed in 0xDBE. This appears to be an issue with 0xDBE not properly supporting the GO for separation of batches. A quicker example:
DECLARE @Test INT;
SET @Test = 1;
PRINT @Test;
GO
DECLARE @Test VARCHAR(1);
SET @Test = '1';
PRINT @Test;
GO
In SSMS it prints as expected, in 0xDBE you get:
[2014-11-13 10:16:45] [S1000][134] The variable name '@Test' has already been declared. Variable names must be unique within a query batch or stored procedure.
This makes 0xDBE fairly limited for writing and executing more complex scripts.
There also appears to be some sort of issue with temporary tables and modifying them between executions of a block like IF OBJECT_ID...IS NULL DROP TABLE #Temp / CREATE TABLE. I've often run into situtations where if I add or modify a column in that temp table it will throw an error instead of executing the DROP the next time I run it. It won't work until I specifially drop the table outside of the code block manually, and then it will execute fine without any other changes. I haven't been able to isolate this behaviour enough to re-create it though.
Please sign in to leave a comment.
Thank you. Created:
https://youtrack.jetbrains.com/issue/DBE-969
https://youtrack.jetbrains.com/issue/DBE-970
The last issue requires a bit of play around, will do it later. If you can provide a sample script to demonstrate the problem, please do.
Regards,
Alexander.
I wrote a stored procedure in Azure SQL Database. Throughout the stored procedure I added many lines like:
RAISERROR('Reached point X.', 10, 7) WITH NOWAIT;I thought this might help me with debugging. But yeah, on the “Output” tab, DataGrip doesn't seem to display these informational “error” messages until the stored procedure execution completes. So, it doesn't help. (Because I am debugging a stored procedure that never completes!)
I read through DBE-969, where it says “we shall add [have now added, I assume] async getWarnings() polling for a running statement.” What does this mean? I've searched, but I cannot figure it out. Is there some way for me to fetch these informational “error” messages that have been raised, during the execution of the stored procedure? (Or, ideally, have DataGrip display them in real time?)
Many thanks!
DataGrip 2024.3.3
Build #DB-243.23654.19, built on December 17, 2024
Runtime version: 21.0.5+8-b631.30 amd64 (JCEF 122.1.9)
Windows 11.0
The stored procedure is defined like below. I'm not sure if I should expect it to show the messages that are within the TRANSACTION, before that transaction is COMMITted? But when I start executing the procedure, it doesn't even show the first message ('Started execution!'), which is before the transaction begins.
I was able to reproduce it and have reported this issue omn our tracker:
RAISERROR messages are not written into the output
https://youtrack.jetbrains.com/issue/DBE-23406
Please follow this issue to stay updated on the progress.