EXEC msdb.dbo.sp_send_dbmail
@profile_name = '1',
@blind_copy_recipients = '[email protected]',
@subject = '',
@body= '',
@query =
'SELECT d.warehouse,d.order_line_no AS Line,d.product AS Product ,d.qty_ordered AS QTY ,CONVERT(NUMERIC(18,0),(sum(d.qty_ordered*d.cost_price_u))) AS Cost,d.long_description AS Detailed
FROM scheme.poheadm_alerts i with (NOLOCK)
JOIN scheme.podetm d with (NOLOCK)
ON i.order_no=d.order_no
WHERE i.Sent = "N"
GROUP BY d.order_line_no,d.product,d.qty_ordered, d.warehouse,d.long_description',
@execute_query_database = 'demo'
|