|
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"goEXEC 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_Datefrom 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%'' ANDDEPARTMENT_DESCRIPTION NOT LIKE ''TERMINATED MEMBER'' order by department_description '" |
|