Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)

  • RE: converting Year and Month varchar to date

    Try

    ALTER TABLE table

    ADD [Date] date;

    go

    UPDATE table

    set [Date]= DateFromParts(cast([Year] as int), cast([Month] as int), 1);

    go

    /*

    ALTER TABLE table

    DROP COLUMN [Year], [Month];

    */

    or

    ALTER TABLE table

    ...

  • RE: Subtotal when vendorcode changed.

    Try

    ;with

    T as (

    SELECT VendorCode, 1 as Seq, UnitPrice, Qty, (UnitPrice * Qty) as Total

    from Sales

    union

    SELECT VendorCode, 2, sum(UnitPrice), sum(Qty), sum(UnitPrice * Qty)

    from Sales

    ...

Viewing 2 posts - 1 through 2 (of 2 total)