Link to home
Start Free TrialLog in
Avatar of binaryman101
binaryman101Flag for United States of America

asked on

Setting my own parameters for a comma csv file

I have the following query I am working on with a send mail command.  I would like it to separate my values by commas at a predetermined spacing which is fine for the application I am working with.   I thought I had it working but now it keeps giving me the following error:

Msg 119, Level 15, State 1, Line 3
Must pass parameter number 14 and subsequent parameters as '@name = value'. After the form '@name = value' has been used, all subsequent parameters must be passed in the form '@name = value'.


I am guessing I am just forgetting something somewhere.  I am a newby to this and would appreciate any help you can provide.
EXEC msdb.dbo.sp_send_dbmail

@profile_name = 'profile1'
,@recipients = 'test@test.com'
,@subject = 'CSV FILE OUTPUT TEST'
,@attach_query_result_as_file = 1
-- can go to 32767 for query width
,@query_result_width = 32767
,@body_format = 'TEXT'
,@body = ''
,@append_query_error = 0
,@exclude_query_output = 0
,@query_no_truncate = 0
,@query_attachment_filename =  'Outputfile.csv'
,@query_result_separator = ','
,@query = 'select InvoiceNumber = convert(varchar(10),InvoiceNumber) + ',' + InvoiceDate = convert(varchar(10),InvoiceDate) FROM [Billing Automation Processes].dbo.[Z4019 - CSX Export 50985 5th]'

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of binaryman101

ASKER

That fixed the errors.  Thanks