Results 1 to 2 of 2

Thread: xp_sendmail driving me mad !

  1. #1
    MARK DAVIES Guest

    xp_sendmail driving me mad !

    Has anyone else noticed that if you create a non-existing file as an attachment using xp_sendmail in SQL Server 2000, it does not create a copy of that file on the Hard Drive, nor does it format the attached file sensibly if you attach it as a .csv file ?

    I am using the procedure below :-

    CREATE PROCEDURE mailtest AS

    declare @sql varchar (255)

    SELECT PERSONID, FORENAME, SURNAME INTO ##TEMP FROM PERSON

    SELECT @sql='SELECT * FROM ##TEMP'

    IF @@ROWCOUNT > 0

    begin

    exec master.dbo.xp_sendmail
    @recipients = 'itsmarkdavies@hotmail.com',
    @Message = 'Test file',
    @Query = @sql,
    @attachments = 'C:MARKTEST.CSV',
    @Attach_Results = 'True',
    @Message = '',
    @Subject = 'test',
    @No_Header = 'True',
    @Width = 500,
    @Separator = ','

    end
    DROP TABLE ##TEMP
    GO

    In the example above, the file MARKTEST.CSV does not currently exist, but the procedure should create it, put it in the root of C: and e:mail it, as it did when it ran under SQL Server 6.5. However, under 2000 it now doesn`t put a copy on the Hard Drive and it formats the .csv file in a very odd manner.




  2. #2
    paul Guest

    xp_sendmail driving me mad ! (reply)

    try searching ...

    www.sqlteam.com


    ------------
    MARK DAVIES at 1/11/2002 8:51:30 AM

    Has anyone else noticed that if you create a non-existing file as an attachment using xp_sendmail in SQL Server 2000, it does not create a copy of that file on the Hard Drive, nor does it format the attached file sensibly if you attach it as a .csv file ?

    I am using the procedure below :-

    CREATE PROCEDURE mailtest AS

    declare @sql varchar (255)

    SELECT PERSONID, FORENAME, SURNAME INTO ##TEMP FROM PERSON

    SELECT @sql='SELECT * FROM ##TEMP'

    IF @@ROWCOUNT > 0

    begin

    exec master.dbo.xp_sendmail
    @recipients = 'itsmarkdavies@hotmail.com',
    @Message = 'Test file',
    @Query = @sql,
    @attachments = 'C:MARKTEST.CSV',
    @Attach_Results = 'True',
    @Message = '',
    @Subject = 'test',
    @No_Header = 'True',
    @Width = 500,
    @Separator = ','

    end
    DROP TABLE ##TEMP
    GO

    In the example above, the file MARKTEST.CSV does not currently exist, but the procedure should create it, put it in the root of C: and e:mail it, as it did when it ran under SQL Server 6.5. However, under 2000 it now doesn`t put a copy on the Hard Drive and it formats the .csv file in a very odd manner.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •