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
 Import/Export (DTS) and Replication (2000)
 Mailed results of a Select statement run in a DTS Package empty

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-02-10 : 08:04:11
John writes "Hello - Any area's I should be looking at as to why when I run a query in query analyzer everthing runs okay and I get me results as expected/desired BUT when the query is tagged onto the end of the create table statement packaged up in a DTS package the result mailed to me shows no data ?..See below cut out in its entirety from the create table portion of the DTS package.

Thank you...John...

CREATE TABLE [Northwind].[dbo].[PERSONNEL_LDM]([BADGE] char(5)
NOT NULL, [SURNAME] char(24) NULL, [G1] char(12) NULL, [G2]
char(12) NULL,
[RANK] char(30) NULL, [TERMINATION_DATE] smalldatetime
NULL, [STREET1] char(30) NULL, [STREET2] char(30) NULL, [CITY]
char(30) NULL,
[PROVINCE] char(2) NULL, [POSTAL_CODE] char(10)
NULL, [COUNTRY] char(3) NULL, [HOME_PHONE] char(12) NULL, [CAR_PHONE]
char(12) NULL,
[SEX] char(1) NULL, [MANUAL_UPDATE] char(1)
NULL, [MEDICAL_ALERT_FLAG] char(1) NULL, [JOB_CODE] char(6)
NULL, [WORK_NUMBER] char(12) NULL,
[EXTENSION] char(4) NULL,
[MAIL_GROUP] char(8) NULL, [HIRE_DATE] smalldatetime NULL, [JOB_DESCRIPTION]
char(30) NULL, [PAGER] char(12) NULL,
[AGENCY_CODE] char(5)
NULL, [HRIS_POSTAL_CODE] char(10) NULL, [HRIS_PROVINCE] char(2)
NULL, [DEPARTMENT] char(10) NULL,
[UNLISTED_PHONE] char(3)
NULL, [MAIL_GROUP_DESCRIPTION] char(30) NULL, [DEPARTMENT_DESCRIPTION]
char(30) NULL,
[EMPLOYEE_NUMBER] char(7) NULL, [HELP_DESK_ID]
int NULL)

GRANT SELECT ON personnel_LDM TO "Johnny"
go

EXEC master..xp_sendmail 'Johnny', 'Please setup AHD and NT accounts for the following, then Email and Profiles
',

@dbuse = 'Northwind', @set_user = 'Johnny',
@echo_error = 'TRUE', @attach_results = 'false', @width = 600,
@subject = 'Personnel needing NT and AHD accounts for today ',

@query = '

Select Badge, Surname, G1, Job_Code, Department_Description, Termination_Date
from PERSONNEL_LDM where BADGE not in( Select c_userid from ctct where c_userid is not null )
AND len( badge ) < 5 AND TERMINATION_DATE IS NULL and DEPARTMENT_DESCRIPTION NOT LIKE ''RETIRED MEMBER%'' AND
DEPARTMENT_DESCRIPTION NOT LIKE ''TERMINATED MEMBER''
order by department_description '"
   

- Advertisement -