Showing posts with label xp_sendmail. Show all posts
Showing posts with label xp_sendmail. Show all posts

Thursday, February 16, 2012

blank lines

This may be an incredibly easy fix, but I can't figure it out!

I'm working with xp_sendmail, and I'm trying to get it send out 2 separate queries.

The problem is that in the body of the e-mail, it puts the right after each other, so it's kind of bad to look at.

Is there any way I can insert a few blanks lines in between these 2 queries ? I tried a simple "print ' ' ", but I get access violation errors.

Suggestions?Well, this may not be an elegant solution, but you can always place a few statements like:

select ''

between your queries to add some blank space. Actually, this may print line separators defpending on your connection configuration, but you can also try something like this:

select char(13) + char(13) + char(13) + char(13) + char(13)

...which will pad your output with five carriage returns.

blindman|||Well that works, but as you said, the line separator shows up, which is kind of an eyesore. Do you or anyone else know any workarounds to this?|||Use the Char(13) method and you can include as many line-feeds as you want and you should only get one separator for the statement.

blindman

Sunday, February 12, 2012

Bizare xp_sendmail error

Use master
--This works
exec xp_sendmail 'scott_riehl@.b-f.com', @.message='test message'
--This does not work
exec xp_sendmail 'scott_riehl@.b-f.com', @.query='select [name] sysusers'
results are
"ODBC error 4604 (42000) There is no such user or group 'sa4'."
and the 'sa4' changes from 'sa4', to 'sa8', to 'sa0', 'sa' + some random
number.
I've never seen anything like this before, any ideas?
TIA,
ScottDid you forget to include "from" in your query statement?
"Scott Riehl" <scott_riehl@.westmaininteractive.com> wrote in message
news:un5QtxbEEHA.688@.tk2msftngp13.phx.gbl...
> Use master
> --This works
> exec xp_sendmail 'scott_riehl@.b-f.com', @.message='test message'
> --This does not work
> exec xp_sendmail 'scott_riehl@.b-f.com', @.query='select [name] sysusers
'
>
> results are
> "ODBC error 4604 (42000) There is no such user or group 'sa4'."
> and the 'sa4' changes from 'sa4', to 'sa8', to 'sa0', 'sa' + some random
> number.
> I've never seen anything like this before, any ideas?
> TIA,
> Scott
>
>
>
>|||Scott,
See if the resolution found here helps:
http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=25318
By the way, the query you are submitting is invalid or you have a typo
here. It isn't likely to work with
select [name] sysusers
so make sure whatever query you submit runs successfully in Query Analyzer.
Steve Kass
Drew University
Scott Riehl wrote:

>Use master
>--This works
>exec xp_sendmail 'scott_riehl@.b-f.com', @.message='test message'
>--This does not work
>exec xp_sendmail 'scott_riehl@.b-f.com', @.query='select [name] sysusers'
>
>results are
>"ODBC error 4604 (42000) There is no such user or group 'sa4'."
>and the 'sa4' changes from 'sa4', to 'sa8', to 'sa0', 'sa' + some random
>number.
>I've never seen anything like this before, any ideas?
>TIA,
>Scott
>
>
>
>
>|||Sorry, that was a typo, the 'From' clause is present.
"Scott Morris" <bogus@.bogus.com> wrote in message
news:%236hl67bEEHA.624@.TK2MSFTNGP10.phx.gbl...
> Did you forget to include "from" in your query statement?
> "Scott Riehl" <scott_riehl@.westmaininteractive.com> wrote in message
> news:un5QtxbEEHA.688@.tk2msftngp13.phx.gbl...
>|||Thanks, that is a typo, sorry.
The link is appropriate, I'll try their recommnedations.
Scott
"Steve Kass" <skass@.drew.edu> wrote in message
news:unoqbJcEEHA.3088@.tk2msftngp13.phx.gbl...
> Scott,
> See if the resolution found here helps:
> http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=25318
> By the way, the query you are submitting is invalid or you have a typo
> here. It isn't likely to work with
> select [name] sysusers
> so make sure whatever query you submit runs successfully in Query
Analyzer.
> Steve Kass
> Drew University
> Scott Riehl wrote:
>
>|||I should have known......a quick reboot fixed everything!
Scott
"Steve Kass" <skass@.drew.edu> wrote in message
news:unoqbJcEEHA.3088@.tk2msftngp13.phx.gbl...
> Scott,
> See if the resolution found here helps:
> http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=25318
> By the way, the query you are submitting is invalid or you have a typo
> here. It isn't likely to work with
> select [name] sysusers
> so make sure whatever query you submit runs successfully in Query
Analyzer.
> Steve Kass
> Drew University
> Scott Riehl wrote:
>
>