jeudi 13 août 2015

sql delete double output

I'm running a microsoft sql server. I need to do something along the lines of the following: (not working code, its just to get my point across)

DECLARE @old TABLE ( locatie NVARCHAR(256), gebruiker NVARCHAR(256), tijd DATETIME )
DECLARE @tot INT
DELETE FROM dbo.DW_D_Locaties_Inpak_Productie
    OUTPUT deleted.locatie, deleted.gebruiker, deleted.productiedatum INTO @old (locatie, gebruiker, tijd)
    OUTPUT SUM(deleted.aantal) INTO @tot
    WHERE DocumentNr='B424609'

how do I do this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire