Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending emails to several users from a query
Message
From
27/04/2009 22:36:36
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Sending emails to several users from a query
Miscellaneous
Thread ID:
01396601
Message ID:
01396601
Views:
119
I can send emails now from SQL, but I was wondering how to send emails to several recipients from a query and also the body contain information from another query. I used:
USE sipcopia
GO
EXEC msdb.dbo.sp_send_dbmail @profile_name='CorreoHelpdesk',
@recipients='SELECT     Usuario.Email AS responsablegrupo, Usuario_1.Email AS responsablepropuesta
FROM         ResponsablePropuesta INNER JOIN
                      Propuesta ON ResponsablePropuesta.Idpropuesta = Propuesta.IdPropuesta INNER JOIN
                      Prospecto ON Propuesta.IdProspecto = Prospecto.IdProspecto INNER JOIN
                      Estado ON Propuesta.IdEstado = Estado.IdEstado INNER JOIN
                      Usuario ON ResponsablePropuesta.RespGrupo = Usuario.IdUsuario INNER JOIN
                      Usuario AS Usuario_1 ON ResponsablePropuesta.RespPropuesta = Usuario_1.IdUsuario
WHERE     (DATEDIFF(y, GETDATE(), ResponsablePropuesta.FechaPlanEntrega) = 1)',
@subject='mensaje de prueba',
@body='Don Jose, si le llega este correo por favor confirme a.' 
but it seems not working. How can i solve this?
Next
Reply
Map
View

Click here to load this message in the networking platform