I'm having trouble trying to get this to work:
This is the error I get when I run this script can anyone point anything out that I might have missed or re write it for me so it does work also what is the best way to do this so it does it weekly in a SQL Job?
Error I get when I run the code below it:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '='.
@profile_name = 'WESA DC Weekly',
@recipients = 'firstname.lastname@example.org',
@query ='select nStartLocationID,nEndLocationID,nDonorCount,tEffectiveDate,cChangedBy
where nOrganizationID = @nORGID
and nDonationTypeID = @nDonationTypeID
and tEffectiveDate between @startdate and @enddate
ORDER BY tEffectiveDate'
@subject = 'Test email',
@attach_query_result_as_file = 1,
@query_result_separator=' ' -- tab