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
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