Results 1 to 2 of 2

Thread: how to run a stored procedure from xp_sendmail

  1. #1
    Lakshmi Guest

    how to run a stored procedure from xp_sendmail

    hi,

    I trying to call a stored procedure with parameter from xp_sendmail. I am getting syntax error. Is there anyone who can help me?
    here is the code I am using...

    execute master.dbo.xp_sendmail @recipients='lakshmip@oasisnetwork.com', @message='Leads Information',
    @query='Execute LeadDistribution..sp_sendmailB '+@AssToID''


  2. #2
    gopal Guest

    how to run a stored procedure from xp_sendmail (reply)

    Hi,

    I believe we cannot manuipulate strings while passing value for parameter. But we can move this value into temp variable and pass it into stored procedure. For example, assuming @assToid is integer


    declare @strquery varchar(50)
    select @strquery = 'Execute LeadDistribution..sp_sendmailB ' + convert(char,@AssToID)
    execute master.dbo.xp_sendmail @recipients='lakshmip@oasisnetwork.com', @message='Leads Information',
    @query=@strquery

    Regards,
    Gopal


    ------------
    Lakshmi at 1/22/01 2:12:43 PM

    hi,

    I trying to call a stored procedure with parameter from xp_sendmail. I am getting syntax error. Is there anyone who can help me?
    here is the code I am using...

    execute master.dbo.xp_sendmail @recipients='lakshmip@oasisnetwork.com', @message='Leads Information',
    @query='Execute LeadDistribution..sp_sendmailB '+@AssToID''


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •