TSQL query to output into a variable

  • I have the following query

    select name,size,maxsize,filename from sysaltfiles

    where size > (maxsize/1.25)and maxsize <> -1

    which lists all the files whose growth has grown to more than 80% of the restircted growth size

    my problem is I need to email the output (using xp_smtp_sendmail not mapi) I can't get the

     

    can someone help me please ????

    thanks

    Mike

     

  • Try DTS

  • If you have SQLMail set up and it is working properly, you could always try the following:

    EXEC master.dbo.xp_sendmail @recipients = 'you@yours.com'

        ,@message = 'message here'

        ,@subject = 'subject',

        ,@query = 'select name,size,maxsize,filename from sysaltfiles where size > (maxsize/1.25)and maxsize <> -1'

  • first try to send a test mail using an enterprise, there is 1 option to send an email, if u get an email, then there is somethign wrong with your code,

    to make xp_sendmail to work, u need to lot of other settings, its too big

     

    <a href="http://www.websolsoftware.com"> For IT jobs click here</a>

    *Sukhoi*[font="Arial Narrow"][/font]

  • Can't quite read what your problem is - mailing or getting the filelist into the mail..

    If it's the latter, just run the query from osql with -o pointing to a filename, then exec xp_smtp_sendmail and attach the file...

    /Kenneth

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply