Results 1 to 2 of 2

Thread: xp_sendmail, ODBC Error Codes. Thanks for the previous Help.

  1. #1
    Dre Guest

    xp_sendmail, ODBC Error Codes. Thanks for the previous Help.

    Send Mail works fine when I just want to send a message. However, when I try to send the results from a query as an attachment, I get a ODBC error. Here is example of the code and the error code that I recieve.

    Use MyDatabase
    go
    exec master.dbo.xp_sendmail 'Doe,John',
    @query = 'Select * from tblMyTable',
    @subject = 'SQL Server Report',
    @message = 'The contents of the tblMyTable:',
    @attach_results = 'TRUE', @width = 250
    go

    ---------------------------------------------------

    Error: ODBC error 208 (42S02) Invalid object name 'tblMYTABLE'.

    Can someone tell me what am I doing wrong?


  2. #2
    Join Date
    Nov 2005
    Posts
    1

    Lightbulb

    you'll have to specify the server.dbo before the table.

    for example,

    Select * from SERVERNAME.DBO.tblMyTable

    I just had the same problem and this made it work, so I thought I'd tell you too!!

Posting Permissions

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