• ShawnBryan - Wednesday, February 28, 2018 3:48 AM

    experts, Thanks for your feedback.
    Actually, I am trying to develop DML for cashier with drivers shipment cash entry. Each day driver might have multiple shipments i mean delivery loads. Let say driver maria is having 3 shipments for a day . So when first time maria data inserted in to table then its should auto insert with value (1)and then same driver maria data inserted second time then its should auto insert with value (2) and same driver maria data inserted  third time then its should auto insert with value (3.) 
    Here key identifier for auto insert is name.
    And this will keep rotating  everyday since same driver will have shipment every day. I mean sunday might have 1 shipment and monday might have 2 shipment its goes on.

    I am using .Net framework for the same but meanwhile trying to see if anything can be done via SQL too.

    A

    None of that changes the fact that the design is bad.  You would be far better off deriving those numbers based on the specific driver (again, a foreign key value from a separate table of the drivers), and the date/time of the cash entry.   You can always easily derive those numbers using the ROW_NUMBER() function using the PARTITION BY clause within the OVER clause, so you can easily run a query that gets you that information any time you want it.  It does NOT need to be stored in the database.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)