Skip to content

Instantly share code, notes, and snippets.

@swimtver
Created March 23, 2015 15:01
Show Gist options
  • Save swimtver/b167212d22519c95e94e to your computer and use it in GitHub Desktop.
Save swimtver/b167212d22519c95e94e to your computer and use it in GitHub Desktop.
delete damage claim
BEGIN transaction
declare @number varchar(10)
set @number = 'Л519187'
DELETE c
from dbo.Comments c
join dbo.Workitems wi ON wi.Id=c.WorkItemId
JOIN Claim.DamageClaims dc ON dc.Id = wi.DamageClaimId
where Number = @number
DELETE wi
from dbo.Workitems wi
JOIN Claim.DamageClaims c ON c.Id = wi.DamageClaimId
where Number = @number
DELETE
FROM [Moas].[Claim].[DamageClaims]
where Number = @number
ROLLBACK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment