with logData as ( select transactionId, transactionTime, transactionType, coalesce( statusCode, 'PENDING' ) statusCode, url, responseTime , cast(datediff(minute, transactionTime, responseTime ) as numeric(10, 2)) as elapsedTime , (datediff(minute, coalesce( responseTime, getDate() ), getdate() ) / 60) as hours , ip_address from tbl_API_Log with (nolock) ) #forJSON( 'logData', attributes.datastore, 'transactionTime desc' )#