• That's a good effort. You can do updates to several columns in a single statement.

    Declare @DayInterval INT;

    Set @DayInterval = Datediff(day,(select MAX(dviendtime) from PrmDeviceVisit),GetDate());

    Update dbo.PrmDeviceVisit

    Set DviEndTime = DATEADD(DAY,@DayInterval,DviEndTime),

    DviStartTime = DATEADD(DAY,@DayInterval,DviStartTime);

    I'd usually won't use this on a heavily used environment, but as I assume you're using a personal db to learn, it's fine for now, but you'll have to learn to deal with concurrency later on.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2