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 Administration (2000)
 parameter 'attachments' in xp_readmail

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-10-04 : 10:02:42
aigars writes "hi,
sorry in advance for my english:)

so,
i need to get e-mail message attachment (*.txt), read data from it and then put these data into table.
it must happen automatically.

i have the job that launch stored procedure,
that uses xp_readmail for checking mailbox.

procedure xp_readmail has parameter 'attachments'
which returns string of attached files separated by ";"
this procedure also puts attachment in temporary directory...
(something like this 'C:\DOCUME~1\aigars\LOCALS~1\Temp\yo.txt')

can i change the location of this file? (attachment must be saved in another directory)

and is this possible to extract data from saved file with BCP and put data into the table?"

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-10-04 : 14:23:08
Not tried this as I don't have Outlook at home to test SQL Mail but you could logon to the SQL Server (which I assume is your pc actually because of your name in the temp path) and change the TEMP and TMP enviroment variables to a different folder e.g. d:\temp

Its picking up the temp folder from the user profile associated with the mail profile it would seem.

As for loading the contents then yes you can use bcp or BULK INSERT to load the data.


HTH
Jasper Smith
Go to Top of Page
   

- Advertisement -