SQL Server >> URGENT : Sending Multiple Views with using xp_sendmail

by RGV2aWwgR2FyZmllbGQ » Thu, 16 Sep 2004 11:17:01 GMT

Dear fellow experts,

I want to use xp_sendmail to send 3 views (with the below format):

List of Form One Student

Class: F1A <== {Name of view 1, can be hardcode}
Student_Name Student# Sex
----------------- ------------ ------
Ada 1234 F
Ben 2345 M
<=== {View 1}
Carey 4567 F
:
{ A ROW OF SPACE HERE}
Class: F1B <== {Name of view 2, can be hardcode}
Student_Name Student# Age
----------------- ------------ ------
Dora 6789 F
Ella 8523 F
<=== {View 2}
Fonia 3698 F
:
{ A ROW OF SPACE HERE}
Class: F1C <== {Name of view 3, can be hardcode}
Student_Name Student# Age
----------------- ------------ ------
Gigi 7539 F
Hibra 4862 F
<=== {View 3}
Ivan 6438 M
:
{ A ROW OF SPACE HERE}

How can I script the code to perform this output ?? thanks very much !!!


SQL Server >> URGENT : Sending Multiple Views with using xp_sendmail

by Tibor Karaszi » Thu, 16 Sep 2004 14:12:47 GMT


Just pass three SELECT statements to the @query parameter. Or, do three EXEC procname in the
parameters, if you are using stored procedures.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/









SQL Server >> URGENT : Sending Multiple Views with using xp_sendmail

by RGV2aWwgR2FyZmllbGQ » Fri, 17 Sep 2004 09:15:01 GMT

Dear Tibor,

Thanks for your helping and your solution really give me a great help for me
!!!!







Similar Threads

1. Send several views with xp_sendmail

Dear experts,

I want to run a query that get several views from the database and then send 
these views with using xp_sendmail.

How can I perform this function in the @query in the xp_sendmail ???

Thanks very much !!!

2. Sending Mail using xp_sendmail - SQL Server DTS

3. Sending an Attachment using XP_sendmail

Hi all,
I know it is possible to send an attachment thru XP_Sendmail.
The file name will change everday due to the date in the file name. so I 
created a variable to hold the file location and name.  when I run the below 
I get an error:
Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80004005

If I remove the     @attachments = @attach
it works fine.

Can anyone tell me what I am doing wrong with the attachment?
TIA,
Joe
declare @title varchar(50),@email varchar(2000),@attach varchar 
(200),@fileName varchar(30),
@date datetime,@date1 int


Set @date = (select * from dbo.Temp_ISOXML_Attr)
--select @date
Set @date1 = convert(varchar,@date,112)
--Select @date1
set @fileName = 'IcenterReport'+convert(varchar,@date1)
set @title= 'Icenter report Attached' 
set @attach = '\\sqld1\E$\XmlFiles\'+convert(varchar,@date1)
select @attach

set @email='Here is the ISO File'
 
EXEC master..xp_sendmail @recipients = ' XXXX@XXXXX.COM ',
    @message = @email,
    @subject = @title,
    @attachments = @attach

4. using xp_sendmail to send html type content - SQL Server

5. Sending HTML using xp_sendmail

I use xp_sendmail to send a link to our clients.  But the link is very long.
How can I send an html message using xp_sendmail?

Thanks for your help,
John


6. problems sending attachments using xp_sendmail. - SQL Server

7. Using XP_SendMail to send XML Results file

I have an urgent solution that I'm developing for...

I've written a query for an existing database using the FOR XML
EXPLICIT clause of the SELECT command.  It generates the results I
expect, with one painful exception - its putting in carriage returns
in the middle of tags, or anywhere else it feels like!

Our existing solution generates CSV files containing the data, this
works really well.  Our customer now requires these files in XML
format.  I thought it would be no bother just altering the query to
generate the XML.  Not so, these CRLFs get stuck in every 2034
characters.  This invalidates the XML file totally.  Why can't it just
put them in after each tag section is closed like most XML files are
formatted?

We use the XP_SENDMAIL command to transmit files, ideally I don't want
to stop using this.  What is also decidedly undesirable is using any
form of external tool, as have a number of external customers that use
copies of the software and we don't want to have to install new
software (or pay for it!) on their systems.  We don't have any direct
access to these systems so any changes have to be scripted fully in
SQL.

So thats my problem - anyone got any suggestions? Its sending me mad!

Thanks

Mike

8. Multiple queries with multiple attachments in xp_sendmail - SQL Server