Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Error: The executeQuery method must return a result set

Tags:

sql

sql-server

while trying to execute the below query in SQL server I am getting an error SQL Error: The executeQuery method must return a result set.

with cte 
AS
(
    SELECT GUID,seq original_seq_no, ROW_NUMBER()
    OVER ( PARTITION BY GUID ORDER BY seq) AS new_seq_no
    FROM CHK_SEQ
)

update  CHK_SEQ
set     CHK_SEQ.seq = r.new_seq_no
from    cte r
where CHK_SEQ.seq = r.original_seq_no AND CHK_SEQ.GUID= r.GUID;

can any one please help me with this.

like image 784
user2810293 Avatar asked Dec 19 '22 23:12

user2810293


1 Answers

executeQuery method must return a result set

Your query does not return a result set. Is an UPDATE. Use ExecuteNonQuery instead, executeUpdate for Java

like image 55
Remus Rusanu Avatar answered Dec 22 '22 13:12

Remus Rusanu