SQL Server Performance

XP_Sendmail

Discussion in 'General DBA Questions' started by california6, Oct 16, 2007.

  1. california6 New Member

    Hello,
    can anybody suggest, why this isnt working
    exec xp_sendmail @recipients = 'test@yahoo.com',
    @Subject = 'DATABASE INDEX MISSING',
    @message = 'Index is missing',
    @query = 'select * from flex..sysindexes where name = 'IX_TblFactOperations' ---- Some how after name clause, the single quote's isnt working with this combination. i was wondering, what would be the other way to make this work.
    Appreciated if someone please suggest.
    Thanks,
    Cali
  2. Greg Larsen New Member

  3. Greg Larsen New Member

    Sorry about the blank post. Set the query variable outside and use two single qoutes together like so:
    declare @select varchar(100)
    set @select = 'select * from flex..sysindexes where name = ''IX_TblFactOperations'''
    exec xp_sendmail @recipients = 'test@yahoo.com',
    @Subject = 'DATABASE INDEX MISSING',
    @message = 'Index is missing',
    @query = @select
  4. california6 New Member

    Thank you. I will check this out.

Share This Page