• worker bee (1/11/2012)


    I get an error on the CAST;

    select ServerName, Heading, UTCOccurrenceDateTime

    REPLACE(CAST(UTCOccurrenceDateTime as date),'-','/')

    from dbo.Alerts where Heading like '%blocking%'

    AND DATEADD(hh, -6, UTCOccurrenceDateTime) >= DATEADD(day, DATEDIFF(day, 0, GETUTCDATE()), 0)

    order by UTCOccurrenceDateTime

    Did you try the converts?

    SELECT CONVERT(VARCHAR(10), UTCOccurrenceDateTime, 111)

    --or

    SELECT CONVERT(DATE, UTCOccurrenceDateTime, 111)