Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9193

Re: Incorrect sequence records reading from database

$
0
0

When TOP is used with INSERT, UPDATE, MERGE, or DELETE, the referenced rows are not arranged in any order and the ORDER BY clause can not be directly specified in these statements. If you need to use TOP to insert, delete, or modify rows in a meaningful chronological order, you must use TOP together with an ORDER BY clause that is specified in a subselect statement. See the Examples section that follows in this topic.

TOP cannot be used in an UPDATE and DELETE statements on partitioned views.

TOP cannot be combined with OFFSET and FETCH in the same query expression (in the same query scope). For more information, see ORDER BY Clause (Transact-SQL).

see also TOP (Transact-SQL)

 

And I'm not sure if jdbc driver for mssql support T-SQL.

I had the same problem once and I didn't solve it. I changed my sql query to onother logic, with subqueries.

 

If interesting my queries were:

select DATE, TOTALTIME, TICKET_NUMBER, SERVICE_GUID,PERSON_GUID,COMPANY_GUID from SAP_GUID where processed=0 and date=(select min(date) from SAP_GUID where processed=0)

and

update SAP_GUID set processed=1 where processed=0 and date=(select min(date) from SAP_GUID where processed=0)


Viewing all articles
Browse latest Browse all 9193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>