send mail issues

  • declare @msg_query varchar(2000)

    set @msg_query = 'select top 50 * from table1 p, table2 t where p.jnum= t.jnum'

    EXEC msdb.dbo.sp_send_dbmail

    @profile_name = 'Profile',

    @recipients = 'test@abc.com',

    @subject = 'test' ,

    @query = @msg_query,

    @attach_query_result_as_file = 1 ;

    i get this error:

    Error formatting query envalid parameter, probably Invalid Parameter.

    What am i doing wrong?

  • In the below mentioned version, your code snippet worked just fine. Which version are you using?

    Microsoft SQL Server 2005 - 9.00.3282.00 (X64)

    Aug 5 2008 00:48:00

    Copyright (c) 1988-2005 Microsoft Corporation

    Standard Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)

    [font="Courier New"]Sankar Reddy | http://SankarReddy.com/[/url][/font]

Viewing 2 posts - 1 through 1 (of 1 total)

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