Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Need help with ntext as local variable

Author  Topic 

ppuar
Starting Member

28 Posts

Posted - 2003-01-02 : 16:04:55
Problem: I am using xp_readmail to read in an xml document that is emailed to my sql mapi account. I would like to store the message into some kind of text type variable. However, SQL 2k does not allow ntext varibles to be local.

Does someone know a good work around?

Thanks
Pardeep

X002548
Not Just a Number

15586 Posts

Posted - 2003-01-02 : 16:42:20
How about creating a permanent table

Create table TABLE1 (xp_readmail column definitions)

Then do

Insert Into TABLE1 (Columns....) EXEC xp_readmail

Columns need to be defined as the result of eXentded s/p. Look at books online, but here's the result set:

Result Sets
xp_readmail returns a result set with these columns (older messages appear first).

Column name Description
Originator Sender of e-mail message
Date Received Date the e-mail message was received
Recipients The people to whom the message was sent
CC List The people on the CC'd line of the e-mail message
BCC List The people on the BCC'd line of the e-mail message
Subject Subject line of the e-mail message
Message Message body (text)
Unread Whether this message is unread
Attachments Any attachments for the message
Message ID Message ID
Type Message type


Go to Top of Page

ppuar
Starting Member

28 Posts

Posted - 2003-01-02 : 17:50:53
xp_readmail does not output anything to message windows of sql query analyzer. If this not happen, how are the values going to get into the table?

Pardeep

Go to Top of Page

ppuar
Starting Member

28 Posts

Posted - 2003-01-02 : 18:11:07
Ok I figured it out

Now how do I take the message and pass it into sp_xml_preparedocument?

This is what I am trying, but not working:

EXEC sp_xml_preparedocument @idoc OUTPUT, (select message from #xmldocument)

Pardeep

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-01-02 : 18:30:37
There's some code in Ken Henderson's

The Guru's Guide to SQL Server Stored Procedures, XML, and HTML

That does exactly what you need. And it's chock full of other incredibly useful stuff that will completely blow your mind.

Go to Top of Page

ppuar
Starting Member

28 Posts

Posted - 2003-01-02 : 18:35:04
Is this a book?

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-01-02 : 19:26:02
Yes. Take a look in the SQL Team Bookstore for more information.

Go to Top of Page
   

- Advertisement -