• Hi Nakul Vachhrajani,

    Thanks for your replies.

    Let me explain to you what I want to do.

    Routes is the Master table for all routes.

    Pickup is the table for a day where all the staffs have to pickup for their routes.

    And All the data in the Pickup will be copied to PickupHistory when all the packages are delivered (may be in the same day or the next days).

    Saturday Delivery has to be prepared on Friday. If the Holiday is Friday, Saturday Delivery will has to prepared on Thursday.

    As holiday, records will not be copied to Pickup.

    That TSQL will be in the SQL Agent Job and will schedule for weekdays.

    Basically my logic is like that..

    if today <> holiday then

    copy all the records from routes to pickup

    if today = friday or today= holiday-1 then

    copy all the SatDelivery records to pickup

    endif

    endif

    Actually, I can write code in VB.net and run as job schedule or windows service, yet I am not expert.

    But I know there is something I can do with TSQL and I want to learn TSQL a bit.

    Thanks

    zhtway