Results 1 to 2 of 2

Thread: xp_sendmail error

  1. #1
    Mary Guest

    xp_sendmail error

    When I supply the following xp_sendmail statement:

    EXEC Master..xp_sendmail
    'msantoro@itginc.com',
    '',
    'SELECT last_name, first_name FROM db.dbo.tablename'

    I get the following message:
    "Supplied datatype for @query is not allowed, expecting 'varchar' "

    If I change the query above to select just ONE field instead of two it works fine!

    Any ideas are most appreciated.
    thanx...


  2. #2
    Guest

    xp_sendmail error (reply)


    Have you tried the following:

    DECLARE @temp varchar(128)

    SELECT @temp = last_name + ',' + first_name from db.dbo.tablename

    EXEC Master..xp_sendmail 'msantoro@itginc.com', @message = @temp

    In order to use the SELECT statement directly withing the EXEC, you would
    need to use the OUTPUT keyword (which I've never personally done).

    You should also note that the SELECT statement must return one valid set of
    values only (so you'll likely need a WHERE clause)

    Hope this helps
    ------------
    Mary at 3/30/99 9:25:18 AM

    When I supply the following xp_sendmail statement:

    EXEC Master..xp_sendmail
    'msantoro@itginc.com',
    '',
    'SELECT last_name, first_name FROM db.dbo.tablename'

    I get the following message:
    "Supplied datatype for @query is not allowed, expecting 'varchar' "

    If I change the query above to select just ONE field instead of two it works fine!

    Any ideas are most appreciated.
    thanx...


Posting Permissions

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