Forum Replies Created

Viewing post 1 (of 1 total)

  • Reply To: Sorting Months By Number (SQL Spackle)

    In my experience people abuse tempdb, please consider:

    select [Month] = DATENAME(mm,SomeDateTime),

    --[mm] =  datepart(mm, SomeDateTime),

    Amount  = SUM(SomeAmount)

    from

    (

    select   TOP (10000000)

    SomeDateTime = RAND(CHECKSUM(NEWID()))*7305 + CAST('2005' AS DATETIME),

    SomeAmount   = CAST(RAND(CHECKSUM(NEWID()))*100 AS MONEY)

    FROM master.sys.all_columns ac1

    CROSS...

Viewing post 1 (of 1 total)