Results 1 to 3 of 3

Thread: xp_sendmail

  1. #1
    Join Date
    Sep 2003
    Location
    Chicago
    Posts
    5

    Question Unanswered: xp_sendmail

    I am trying to send a resultset via email using xp_sendmail.
    I need to send the email when an earlier executed query has any results.

    Got the query results into a table variable/temp table and then
    in xp_sendmail, using

    "Declare @table_var table(...)

    ..query excution..

    EXEC master.dbo.xp_sendmail @recipients = 'xx@xx.com',
    @query = 'select * from @table_var'"

    it gives error saying that @table_var must be declared.
    even if i use temporary table, the message i get is "cannot reference object in tempdb database."

    any ideas on this.

    Thanks in advance.

  2. #2
    Join Date
    Sep 2003
    Posts
    522
    xp_sendmail cannot see it. create ##table instead.

  3. #3
    Join Date
    Sep 2003
    Location
    Chicago
    Posts
    5
    Thanks for the reply.

    any idea on using table variable instead of temp table

Posting Permissions

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