Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

sp_send_dbmail: Error formatting query, probably invalid p..

 
   Database Help (Home) -> Programming RSS
Next:  DISTINCT AND SELECT * ? All but one column.  
Author Message
nigeaman

External


Since: Jun 09, 2007
Posts: 1



(Msg. 1) Posted: Thu May 01, 2008 9:17 am
Post subject: sp_send_dbmail: Error formatting query, probably invalid parameter
Archived from groups: microsoft>public>sqlserver>programming (more info?)

Hi

When using sp_send_dbmail as follows, I receive an email:

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Mail',
@recipients = 'some.one@somewhere.com',
@body = 'Customer Cleansing Status BODY',
@subject = 'Customer Cleansing Status'

However, when using sp_send_dbmail and the @Query parameter it fails with
the error below:

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Mail',
@recipients = 'some.one@somewhere.com',
@query = 'select * from SAP_Staging.dbo.CustomerIDSequence',
@subject = 'Customer Cleansing Status',
@attach_query_result_as_file = 1,
@query_result_header = 1

Msg 22050, Level 16, State 1, Line 0
Error formatting query, probably invalid parameters
Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 478
Query execution failed: Msg 15404, Level 16, State 19, Server GB-S-0115,
Line 1
Could not obtain information about Windows NT group/user 'NMEA\GBNIROA1',
error code 0x5.

For your info:
1) I have applied my User Account to the DatabaseMailUserRole
2) Test mail works ok
3) the first query works ok
4) select * from SAP_Staging.dbo.CustomerIDSequence returns results
successfully

What am I missing? Any ideas

Nigel

 >> Stay informed about: sp_send_dbmail: Error formatting query, probably invalid p.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Executing a query in sp_send_dbmail - I have a relatively simple query that I can execute on my database and get the expected results. It looks like this: Select databasename, sum(data) from SpaceUsed where databasename not in ("master", "msdb") Group By databasename...

Invalid Column Error - Hi, Can anybody point me why I get the error "Invalid Column Name - emp" error. Thanks. Table structures are: Tree create table tree (emp Char(10) Not Null, Boss Char(10)); Stack CREATE TABLE Stack (Stack_top INTEGER Not Null, emp Char(1...

Invalid column name error missing? - Hi all, I have the following T-SQL script: USE tempdb BEGIN TRAN CREATE TABLE TABLE1(id int, ref int) CREATE TABLE TABLE2(id int) SELECT id FROM TABLE1 WHERE ref IN (SELECT ref FROM TABLE2) DROP TABLE TABLE1 DROP TABLE TABLE2 COMMIT TRAN GO I..

Invalid object error 3420 - I have a VB program that uses an ODBC connection to load data from a flat file into the database. The VB program is invoked on server"A" and the database is on server "B" it uses the ODBC connection from server "A" to con...

Error: is invalid in the select list because it is not con.. - Hi, I have a stored procedure and when I execute it, I always get the following error: "Column 'DistributionPrintReceiptInstance.DistributionCommonInstanceID' is invalid in the select list because it is not contained in either an aggregate functio...
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]