Incorrect results in results grid

Completed

Hi DataGrip support

 

I have written a sql script below (fictious table names) which appears to give me the wrong results. At first pass of this query, I expect to see data in some of the tables. After running the script again, I expect there to be no data. This is not the case. It has retained/cached the previous data. I run the same query in SSMS and the results are as expected, no data in any of the tables. I'd appreciate if you could look into this as soon as possible as I've just started using DataGrip and if I cant rely on it, then I will stop using it:

DECLARE
@findnumber VARCHAR(MAX) = '06041848'
DECLARE
@old_id BIGINT = (SELECT TOP 1 id
FROM MyTable
WHERE number = @findnumber
ORDER BY createddate)
DECLARE
@new_id BIGINT = (SELECT TOP 1 id
FROM MyTable
WHERE number = @findnumber
ORDER BY createddate DESC)

SELECT *
FROM path.table1
WHERE id = @old_id

SELECT *
FROM rad.table2
WHERE id = @old_id

SELECT *
FROM docs.table3
WHERE id = @old_id

SELECT *
FROM op.table4
WHERE id = @old_id

SELECT *
FROM ip.table5
WHERE id = @old_id

BEGIN TRAN
UPDATE path.table1 SET id = @new_id WHERE id = @old_id

UPDATE rad.table2 SET id = @new_id WHERE id = @old_id

UPDATE docs.table3 SET id = @new_id WHERE id = @old_id

UPDATE op.table4 SET id = @new_id WHERE id = @old_id

UPDATE ip.table5 SET id = @new_id WHERE id = @old_id
COMMIT
6 comments

@ Lewis Houlden 

Make sure you've set `Transaction control` to Auto:

and

 

 

0

Hi Vasily

I can confirm the transaction settings were:

I've left the transaction window open so let me know if you have any questions. 

Lewis

0

@Lewis Houlden

For further error investigation could you email vasily.chernov@jetbrains.com me your IDE & SQL logs?

0

@Lewis Houlden

> no data in any of the tables

Why do think that there're no data? According to your query, you do not remove any data by setting a new value @new_id

 

 

0

Hi Vasily

Interestingly, this appears to be an issue with SSMS as after re-installing (due to uninstalling SQL Prompt), it cause query results to return incorrectly. Apologies for wasting your time on this! 

Lewis

0

@ Lewis Houlden,

Great!

We appreciate any feedback after your evaluation.

0

Please sign in to leave a comment.