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

error message with sp_send_dbmail

 
   Database Help (Home) -> Programming RSS
Next:  error message using the sp_send_dbmail  
Author Message
Patrick

External


Since: Aug 28, 2007
Posts: 11



(Msg. 1) Posted: Mon Feb 09, 2009 12:22 pm
Post subject: error message with sp_send_dbmail
Archived from groups: microsoft>public>sqlserver>programming (more info?)

good day,

When using the following code:
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQL',
@recipients = 'sql@ccdcc.ca',
@body = 'The following Databases need your attention: ',
@query = 'Select * from dbo.##Tbl_CombinedInfo',
@subject = 'TESTING email feature from SQL 2005',
@attach_query_result_as_file = 0;

I get hte following error:
Msg 22050, Level 16, State 1, Line 0
Error formatting query, probably invalid parameters

If i remove the @ querry variables and re-execute, it works fine.
Can anyone shead some light on why it would not work when i insert the
@query variable?

Thank you.

 >> Stay informed about: error message with sp_send_dbmail 
Back to top
Login to vote
amish

External


Since: Apr 19, 2007
Posts: 45



(Msg. 2) Posted: Tue Feb 10, 2009 12:24 am
Post subject: Re: error message with sp_send_dbmail [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 10, 1:22 am, Patrick wrote:
> good day,
>
> When using the following code:
> EXEC msdb.dbo.sp_send_dbmail
> @profile_name = 'SQL',
> @recipients = '...@ccdcc.ca',
> @body = 'The following Databases need your attention: ',
> @query = 'Select * from dbo.##Tbl_CombinedInfo',
> @subject = 'TESTING email feature from SQL 2005',
> @attach_query_result_as_file = 0;
>
> I get hte following error:
> Msg 22050, Level 16, State 1, Line 0
> Error formatting query, probably invalid parameters
>
> If i remove the @ querry variables and re-execute, it works fine.
> Can anyone shead some light on why it would not work when i insert the
> @query variable?
>
> Thank you.

I am not getting any error while using @query parameter.
Are you sure that you have type name of temp table correctly?


Amish Shah
http://shahamishm.blogspot.com

 >> Stay informed about: error message with sp_send_dbmail 
Back to top
Login to vote
Patrick

External


Since: Aug 28, 2007
Posts: 11



(Msg. 3) Posted: Tue Feb 10, 2009 6:39 am
Post subject: Re: error message with sp_send_dbmail [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Ok it works now, thank you for testing this out for me.
I've got 1 more question for you then.

Can @Recipients point to one of my Operators under the SQL Server
Agent-->Operators folder. For example: DBA (is an Operator)

Thank you very much.


"amish" wrote:

> On Feb 10, 1:22 am, Patrick wrote:
> > good day,
> >
> > When using the following code:
> > EXEC msdb.dbo.sp_send_dbmail
> > @profile_name = 'SQL',
> > @recipients = '...@ccdcc.ca',
> > @body = 'The following Databases need your attention: ',
> > @query = 'Select * from dbo.##Tbl_CombinedInfo',
> > @subject = 'TESTING email feature from SQL 2005',
> > @attach_query_result_as_file = 0;
> >
> > I get hte following error:
> > Msg 22050, Level 16, State 1, Line 0
> > Error formatting query, probably invalid parameters
> >
> > If i remove the @ querry variables and re-execute, it works fine.
> > Can anyone shead some light on why it would not work when i insert the
> > @query variable?
> >
> > Thank you.
>
> I am not getting any error while using @query parameter.
> Are you sure that you have type name of temp table correctly?
>
>
> Amish Shah
> http://shahamishm.blogspot.com
>
>
>
>
 >> Stay informed about: error message with sp_send_dbmail 
Back to top
Login to vote
Patrick

External


Since: Aug 28, 2007
Posts: 11



(Msg. 4) Posted: Tue Feb 10, 2009 6:40 am
Post subject: Re: error message with sp_send_dbmail [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Ok it works now, thank you for testing this out for me.
I've got 1 more question for you then.

Can @Recipients point to one of my Operators under the SQL Server
Agent-->Operators folder. For example: DBA (is an Operator)

Thank you very much

"amish" wrote:

> On Feb 10, 1:22 am, Patrick wrote:
> > good day,
> >
> > When using the following code:
> > EXEC msdb.dbo.sp_send_dbmail
> > @profile_name = 'SQL',
> > @recipients = '...@ccdcc.ca',
> > @body = 'The following Databases need your attention: ',
> > @query = 'Select * from dbo.##Tbl_CombinedInfo',
> > @subject = 'TESTING email feature from SQL 2005',
> > @attach_query_result_as_file = 0;
> >
> > I get hte following error:
> > Msg 22050, Level 16, State 1, Line 0
> > Error formatting query, probably invalid parameters
> >
> > If i remove the @ querry variables and re-execute, it works fine.
> > Can anyone shead some light on why it would not work when i insert the
> > @query variable?
> >
> > Thank you.
>
> I am not getting any error while using @query parameter.
> Are you sure that you have type name of temp table correctly?
>
>
> Amish Shah
> http://shahamishm.blogspot.com
>
>
>
>
 >> Stay informed about: error message with sp_send_dbmail 
Back to top
Login to vote
amish

External


Since: Apr 19, 2007
Posts: 45



(Msg. 5) Posted: Thu Feb 12, 2009 6:46 am
Post subject: Re: error message with sp_send_dbmail [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 10, 7:40 pm, Patrick wrote:
> Ok it works now, thank you for testing this out for me.
> I've got 1 more question for you then.
>
> Can @Recipients point to one of my Operators under the SQL Server
> Agent-->Operators folder. For example: DBA (is an Operator)
>
> Thank you very much
>
> "amish" wrote:
> > On Feb 10, 1:22 am, Patrick wrote:
> > > good day,
>
> > > When using the following code:
> > > EXEC msdb.dbo.sp_send_dbmail
> > > @profile_name = 'SQL',
> > > @recipients = '...@ccdcc.ca',
> > > @body = 'The following Databases need your attention: ',
> > > @query = 'Select * from dbo.##Tbl_CombinedInfo',
> > > @subject = 'TESTING email feature from SQL 2005',
> > > @attach_query_result_as_file = 0;
>
> > > I get hte following error:
> > > Msg 22050, Level 16, State 1, Line 0
> > > Error formatting query, probably invalid parameters
>
> > > If i remove the @ querry variables and re-execute, it works fine.
> > > Can anyone shead some light on why it would not work when i insert the
> > > @query variable?
>
> > > Thank you.
>
> > I am not getting any error while using @query parameter.
> > Are you sure that you have type name of temp table correctly?
>
> > Amish Shah
> >http://shahamishm.blogspot.com

Smile

I don't think that its possible. You need to provide email id directly
of using some variable for recipients

Thanks and Regards
Amish Shah
http://shahamishm.blogspot.com
 >> Stay informed about: error message with sp_send_dbmail 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
sp_send_dbmail: Error formatting query, probably invalid p.. - 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..

Rollback whole transaction save/keep error message/error s.. - Hi all, In SQL 2005, is it possible to rollback the entire transaction but save/keep the system generated error message/error severity information some where? I tried to store the error message in local memory but once rollback I lost it. Any ideas..

Error Message - Microsoft Cursor Engine error '80040e21' Multiple-step operation generated errors. Check each status value. /Easitrak2006/Form2.asp, line 158 Can someone tell me what is error is?

ERROR MESSAGE - Anyone have a idea about what is meant by below? /****************************************/ Cannot roll back ken. No transaction or savepoint of that name was found. Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION..

sp_send_dbmail - Hello, I'm developing a html mailshot using sp_send_dbmail. It is functioning perfectly except that the html received in the email is truncated to 2000 characters. I suspect that the mail server may have a 2000 character limit on messages. Can you..
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada) (change)
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 ]