I've no idea about transactions in SQL Manager (SSMS) in general. We have a query that we didn't expect to run as long as it did and we're wondering if it'd need to rollback changes if we cancelled it. It's a merge statement between two tables of which DBO.JEST has 700M rows and SAP.JEST has 200M. Our query has been running for 5 hours, and would be best if we cancelled it without it having to rollback since that would take a heck of a long time. Will the query rollback? Can we stop it from rolling back if it does?
Query:
MERGE [sap].JEST AS target
USING (SELECT * from dbo.JEST) AS source
ON (
target.[MANDT]=source.[MANDT] AND
target.[OBJNR]=source.[OBJNR] AND
target.[STAT]=source.[STAT]
)
WHEN MATCHED THEN
UPDATE SET
[MANDT]=source.[MANDT],
[OBJNR]=source.[OBJNR],
[STAT]=source.[STAT],
[INACT]=source.[INACT],
[CHGNR]=source.[CHGNR]
WHEN NOT MATCHED THEN
INSERT (
[MANDT],
[OBJNR],
[STAT],
[INACT],
[CHGNR]
) VALUES (
source.[MANDT],
source.[OBJNR],
source.[STAT],
source.[INACT],
source.[CHGNR]
);